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


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