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: 25 Sep 2007 11:01:04 -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-09-25 11:00 -------
(In reply to comment #35)
> (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
Hey, thanks, Vincent!
> 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.
Great, thanks again for the info and the reference. I appreciate your
exceptional patience, expertise and willingness to help.
> * You need to test your routines on much more values (e.g. very small, very
> large, worst cases...).
Will do. I have done some of these, but in no way can the testing I have done
thus far be called "exhaustive". I suspect that there will be more than a few
instances where it breaks.
Regards,
Paul
--
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.