This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: code optimizations and numerical research


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/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]