This is the mail archive of the gcc@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]

Re: How bad is fast-math?


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>


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