code optimizations and numerical research

Ian Lance Taylor
Mon May 16 15:05: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?

Read "What Every Computer Scientist Should Know about Floating-Point

Unfortunately it's rather hard to understand what these optimizations
do without becoming something of an expert.

As a general rule of thumb, if you do not know the details of IEEE
floating point format, and you are not calculating your precise error
intervals and writing code which relies on them to, e.g., converge--in
other words, if you are just writing code that happens to use floating
point--then you will probably do just fine with -ffast-math.


More information about the Gcc-help mailing list