Bug 4327 - printf does not reliably conform to C standard when printing doubles
Summary: printf does not reliably conform to C standard when printing doubles
Status: RESOLVED WORKSFORME
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.4
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-06 01:43 UTC by Allin Cottrell
Modified: 2018-04-20 13:54 UTC (History)
1 user (show)

See Also:
Host: i686 GNU/Linux
Target: i686 GNU/Linux
Build: i686 GNU/Linux
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Allin Cottrell 2007-04-06 01:43:23 UTC
#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
Comment 1 Ulrich Drepper 2007-04-06 07:15:07 UTC
You're not using the latest code.
Comment 2 Allin Cottrell 2007-04-06 18:13:08 UTC
I just updated to glibc 2.5 plus patches from CVS as made
available by LFS, and the problem is still there.

Is this fixed in 2.6, and if so is there a release date
in mind for that?  Thanks.