This is the mail archive of the
mailing list for the GCC project.
Re: Floating point problems (accuracy).
- From: Chris Lattner <sabre at nondot dot org>
- To: Phil Prentice <philp dot cheer at btinternet dot com>,James E Wilson <wilson at specifixinc dot com>
- Cc: gcc at gcc dot gnu dot org, mike at stec dot clara dot co dot uk, gcc-help at gcc dot gnu dot org
- Date: Tue, 18 Jan 2005 15:38:33 -0600 (CST)
- Subject: Re: Floating point problems (accuracy).
James E Wilson wrote:
Phil Prentice wrote:
We are having a few problems regarding floating point inaccuracies
under Linux. Please see the code below.
This is PR 323 in our bug database. One of our most commonly reported
problems. We call this the excess precision problem.
This problem has been known for about 15 years now, and hasn't been
fixed yet. My suspicion is that it never will be.
Another option is that you can try out the LLVM compiler
(http://llvm.org). The CVS version of LLVM supports a
--disable-excess-fp-precision flag, which causes it to emit the extra
rounding operations needed to give "correct" 32 and 64-bit FP results,
even when using the X86 floating point stack.
Note that this is severely slow down your code if it is FP intensive, but
it will produce correct results. As James mentions, using SSE is a much
better approach if possible.