public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "aph at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libgcj/16122] gij - Incorrect result due to computations in extended precision on x86 Date: Tue, 14 Feb 2006 15:45:00 -0000 [thread overview] Message-ID: <20060214154551.27983.qmail@sourceware.org> (raw) In-Reply-To: <bug-16122-5724@http.gcc.gnu.org/bugzilla/> ------- Comment #4 from aph at gcc dot gnu dot org 2006-02-14 15:45 ------- A bit more explanation. The problem is caused by the fact that 9007199254740994.0 + 0.9999847412109375 is carried out in extended precision, and the result is rounded to 9007199254740995. In double precision, the result of this calculation is rounded to 9007199254740994. When the extended-precision value is rounded to double for storing, it is rounded (again) to 9007199254740996. So, double rounding leads gij to return a value of d that is 2.0, whereas it should be 0.0. Note however, that the true accurate value for d, calculated at infinite precision, is 1-(2^-16). So, the absolute error for gcj is 1+(2^-16) and the absolute error with correct rounding is 1-(2^-16). (I'm not surprised this hasn't been reported as a problem with any real applications!) It might be worth setting the floating-point precision of gcj to double, but that would only fix the double-precision case, and I presume we'd still have the same double rounding problem for floats. And in any case, I do not know if libcalls would be affected by being entered with the FPU in round-to-double mode. We might end up breaking things. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16122
next parent reply other threads:[~2006-02-14 15:45 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-16122-5724@http.gcc.gnu.org/bugzilla/> 2006-02-14 15:45 ` aph at gcc dot gnu dot org [this message] 2006-02-14 17:03 ` vincent at vinc17 dot org 2004-06-21 19:58 [Bug libgcj/16122] New: " debian-gcc at lists dot debian dot org 2004-06-21 20:24 ` [Bug libgcj/16122] " pinskia at gcc dot gnu dot org 2004-06-22 6:04 ` vincent at vinc17 dot org 2004-06-22 6:05 ` vincent at vinc17 dot org 2004-06-22 16:51 ` mckinlay at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20060214154551.27983.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).