[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: code optimizations and numerical research

From: Brian Gough
Subject: Re: code optimizations and numerical research
Date: Tue, 17 May 2005 20:37:57 +0100

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

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/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]