This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/4070] New: printf %#.0g does not conform to C99


Consider this simple testcase:

[ampere:/tmp]$ cat test.c
#include <stdio.h>

int main()
{
  printf("%#.0g\n", 0.000956);
  printf("%#.0g\n", 0.000098);
  return 0;
}

[ampere:/tmp]$ gcc -o test test.c -std=c99
[ampere:/tmp]$ ./test
0.0010
1.e-04

According to my understanding of the C99 spec, the output should be:
0.001
0.0001

The freebsd libc seems to confirm that.

-- 
           Summary: printf %#.0g does not conform to C99
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: aurelien at aurel32 dot net
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=4070

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]