This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How bad is fast-math?
- To: jfm2 at club-internet dot fr
- Subject: Re: How bad is fast-math?
- From: Geoff Keating <geoffk at geoffk dot org>
- Date: 29 May 2001 15:55:07 -0700
- CC: gcc at gcc dot gnu dot org
- References: <01053000255002.01578@agnes.fremen.dune>
Jean Francois Martinez <jfm2@club-internet.fr> writes:
> According to the doc fast-math generates incorrect code. Has the situation
> changed? In case it has doc should be updated, in case it hasn't name
> should be changed and become something derogatory since there are people who
> see the fast in fast-math and use it without further investigation. It is
> being used in aLinux distribution and I have seen it recommended in a Linux
> magazine
The actual manual entry says:
`-ffast-math'
This option allows GCC to violate some ANSI or IEEE rules and/or
specifications in the interest of optimizing code for speed. For
example, it allows the compiler to assume arguments to the `sqrt'
function are non-negative numbers and that no floating-point values
are NaNs.
This option should never be turned on by any `-O' option since it
can result in incorrect output for programs which depend on an
exact implementation of IEEE or ANSI rules/specifications for math
functions.
I agree that it should be called something like -fno-ieee.
Since most people don't seem to know how IEEE arithmetic works anyway,
they probably won't notice that that's not what they're getting, and
often the speed increase can be significant.
--
- Geoffrey Keating <geoffk@geoffk.org>