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/4943] Inconsistent rounding behaviour for sprintf and IEEE doubles


------- 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.


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