code optimizations and numerical research
Brian Gough
bjg@network-theory.co.uk
Wed May 18 08:09:00 GMT 2005
Peter Jay Salzman writes:
> The man page claims that "-ffast-math" may produce wrong results for
> programs that depend on "an exact implementation of IEEE or ISO
> rules/specifications for math functions."
>
> What exactly does this vague sentence mean?
The main problem is that Infs and NaNs are manipulated as finite
numbers in optimisations and comparisons with -ffast-math. e.g. you
can find that x-x==0 for x=Inf and other similar oddities. Some
programs use non-standard idioms like if(x!=x) for checking if x is
NaN.
--
Brian Gough
(GNU Scientific Library Maintainer)
p.s. don't forget to profile your program.
Network Theory Ltd,
Publishing "An Introduction to GCC" --- http://www.network-theory.co.uk/gcc/
More information about the Gcc-help
mailing list