From: SourceForge.net <no...@so...> - 2008-09-29 15:23:24
|
Bugs item #2136252, was opened at 2008-09-29 18:23 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2136252&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Roumen Petrov (rumen) Assigned to: Nobody/Anonymous (nobody) Summary: c99, printf and float zero precision Initial Comment: The test program: #include <stdio.h> int main () { float f = 0.003; printf("%.*f\n", -1, f); printf("%.*f\n", 1, f); printf("%.*f\n", 0, f); printf("%.f\n" , f); printf("%.0f\n" , f); printf("%#.0f\n", f); printf("%.*a\n", -1, f); printf("%.*a\n", 1, f); printf("%.*a\n", 0, f); printf("%.a\n" , f); printf("%.0a\n" , f); printf("%#.0a\n", f); printf("%a\n", 30.0) ; printf("%A\n", 30.0) ; printf("%.2a\n", 30.0); printf("%.2A\n", 30.0); return(0); } This program is compiled with following options: 1) -posix -lmingwex 2) without options run on os with msvcrt 7.0x 3) -specs=msvcr90 (as is described in wiki to link with msvcr90) On the first group of test the output is (/ separate results): 0.003000 (same in all cases ) 0.0 (same in all cases ) 0. / 0 / 0 0. / 0 / 0 0. / 0 / 0 0. (same in all cases ) Mingw output extra dot and it seems to me that this is not compatible with c99. The second group of the test 0x1.89374cp-9 / a / 0x1.89374cp-9 0xc.5p-12 / a /0x1.9p-9 0xcp-12 / a / 0x1p-9 0xcp-12 / a / 0x1p-9 0xcp-12 / a / 0x1p-9 0xc.p-12 / a / 0x1.p-9 Ms vcrt 7.0 don't know %a format specifier. No idea what is correct output for c99 standard, but dot in output looks good. The third group: 0x1.ep+4 / a / 0x1.e00000p+4 0X1.EP+4 / a / 0X1.E00000P+4 0xf.00p+1 / a / 0x1.e0p+4 0XF.00P+1 / a / 0X1.E0P+4 I think that mingw and msvcr90 fail on zero precision output(%a). The expected result is 0xfp+1. On the "%.2a" mingw looks good, msvcr90 fail. The question is whether mingwex output (rt version 3.15) is correct in first and third cases ? What is expected output for the second case ? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2136252&group_id=2435 |