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: "vincent+libc at vinc17 dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 22 Sep 2007 13:02:39 -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 vincent+libc at vinc17 dot org 2007-09-22 13:02 -------
Paul, you really make every one (including me) think that you do not understand
floating-point arithmetic. Double-precision numbers are binary numbers, not
decimal numbers. Saying "15-digit precision" is misleading; you should say
"53-bit precision" since their representation is in binary. Now, if you have so
much confidence in Microsoft's C library, I suggest that you try the following
program:
#include <stdio.h>
int main (void)
{
volatile double x = 2597.525;
volatile double y = 5000.525;
printf ("%.2f\n%.2f\n", x, y);
return 0;
}
(please do not change the numbers), and see if you get "consistent" results for
x and for y. And again, I suggest that you read
http://www2.hursley.ibm.com/decimal/
(in particular the FAQ).
--
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.