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-25 10:43 -------
(In reply to comment #34)
> Vincent, one last thing:  Would you mind testing the following on your PPC?

Still wrong for this one:

5000.524999999999636 = 5000.53

But note:

* Some functions like pow are not necessarily correctly rounded, and the
accuracy may be quite bad, so that it is not a good idea to use them.

* I recall that the current rounding mode must be taken into account, and this
is even clearer with a recent correction in the ISO C standard. See
  http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_286.htm
"Change Annex F.5 Binary-decimal conversion: Paragraph 2: 'correctly rounded' to
'correctly rounded (which honors the current rounding mode)'." (but this was
more or less implicit).
If you want to round halfway cases away from 0, you need to wait for this
rounding direction being implemented in the processor (only at this time, the
glibc may need to be updated) or write your own routines.

* You need to test your routines on much more values (e.g. very small, very
large, worst cases...).

-- 


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]