This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/4943] Inconsistent rounding behaviour for sprintf and IEEE doubles
- From: "paul at inet dot co dot za" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 3 Oct 2007 15:07:03 -0000
- Subject: [Bug libc/4943] Inconsistent rounding behaviour for sprintf and IEEE doubles
- References: <20070820142205.4943.paul@inet.co.za>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From paul at inet dot co dot za 2007-10-03 15:07 -------
(In reply to comment #40)
>
> Where did you see it cannot do that? Do you have an example?
>
> (Note that "%.15f" outputs 15 digits after the decimal point, so this may be
> more than 15 digits, taking into account those before the decimal point. You
> should use "%.15g" if you want 15 significant digits.)
Hint: "Paragraph 2: Conversions involving IEC 60559 formats follow all pertinent
recommended practice. In particular, conversion between any supported IEC 60559
format and decimal with DECIMAL_DIG or fewer significant digits is correctly
rounded, which assures that conversion from the widest supported IEC 60559
format to decimal with DECIMAL_DIG digits and back is the identity function."
x = 9.074439913906690
printf("%.15f", x);
9.074439913906691
x = 9.074439913906691
printf("%.15f", x);
9.074439913906691
--
http://sourceware.org/bugzilla/show_bug.cgi?id=4943
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.