Constants and -ffast-math

Toon Moene toon@moene.indiv.nluug.nl
Tue Aug 24 12:19:00 GMT 1999


David Ronis wrote:

> I have all floating-point's declared as doubles, except for explicit
> floating point constants (like 1.0 or 0.0).

> I was under the impression that 1.0 defaults to a double;

In what language ?  (I think this is true in K&R C, but it has been a
while) ...

Note that this doesn't make any difference for the constants 1.0 and 0.0
(which are exactly representable), but it does make a difference for,
e.g., 0.1.

In Fortran, a constant that isn't in any way qualified, is taken to be
default REAL.  This translates to a 4 byte floating point number on all
targets GCC/g77 supports, AFAIK.

> does this
> change with --fast-math?  It shouldn't, but I'm running out of ideas.

No.

> As long as I'm at it, could someone amplify on what exactly
> --fast-math does, beyond the information in the gcc info docs.

I think the only way to really find out is to search for all the places
in the compiler where flag_fast_math is tested ...

-- 
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
GNU Fortran: http://world.std.com/~burley/g77.html


More information about the Gcc mailing list