David Roundy wrote:
On Thu, Aug 31, 2006 at 07:44:33AM +0200, Florian Weimer wrote:
* > On Wed, 2006-08-30 at 14:58 -0400, David Roundy wrote:
It's sad, but we're stuck with it, as I'm not aware of any
compiler that is capable of generating IEEE arithmetic.
Gcc man page:
-ffast-math
You quoted the wrong paragraph. Here's the right one:
`-ffloat-store'
Do not store floating point variables in registers, and inhibit
other options that might change whether a floating point value is
taken from a register or memory.
This option prevents undesirable excess precision on machines such
as the 68000 where the floating registers (of the 68881) keep more
precision than a `double' is supposed to have. Similarly for the
x86 architecture. For most programs, the excess precision does
only good, but a few programs rely on the precise definition of
IEEE floating point. Use `-ffloat-store' for such programs, after
modifying them to store all pertinent intermediate computations
into variables.
But alas, in my experience even -ffloat-store doesn't allow truly
reproducible arithmetic, although it's much better than the default
behavior. I struggled with this quite a while, a few years back, when
trying to implement tests that my parallelization would produce
bitwise identical results to the serial version. I needed both
-ffloat-store and some code-hacks to keep the compiler from doing
anything tricky (but don't quite remember what...).
Nowadays -mfpmath=sse is better than -ffloat-store, because SSE2 has single and
double-precision floating point arithmetic. I get pretty reproducible
arithmetic on x86_64 this way, where SSE2 is the default.
Cheers,
Simon
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users