[Bug libc/4327] New: printf does not reliably conform to C standard when printing doubles

cottrell at wfu dot edu sourceware-bugzilla@sourceware.org
Fri Apr 6 00:43:00 GMT 2007


#include <stdio.h>
int main (void)
{
    double a = 1.0;
    double b = 0.9999999999999999;
    printf("%#12.5g\n", a);
    printf("%#12.5g\n", b);
    return 0;
}

The above produces as output:

      1.0000
     1.00000

According to the C standard it should produce

      1.0000
      1.0000

-- 
           Summary: printf does not reliably conform to C standard when
                    printing doubles
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: cottrell at wfu dot edu
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: i686 GNU/Linux
  GCC host triplet: i686 GNU/Linux
GCC target triplet: i686 GNU/Linux


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

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



More information about the Glibc-bugs mailing list