This is the mail archive of the
mailing list for the GCC project.
Re: What is acceptable for -ffast-math?
- To: <gcc at gcc dot gnu dot org>
- Subject: Re: What is acceptable for -ffast-math?
- From: Jeremy Sanders <jss at ast dot cam dot ac dot uk>
- Date: Thu, 2 Aug 2001 20:07:40 +0100 (BST)
Just writing my thoughts here... I write (and use) a fair amount of
numerical code, mostly in the field of astronomical data
analysis/modelling. The proposals to rewrite slower expressions into
faster ones, eg
a/b/c -> a/(b*c)
would be a very useful one for the time consuming codes we run. This is
especially true for the C++ code I write, which needs significant
optimisation after inlining.
The point is, this would be an option which would be explicitly enabled,
and so there's no problem about breaking IEEE standards. In addition, if
one is writing code to handle numbers on the order of the maximum value in
a float/double, then there's a good argument that these types are
inappropriate. Losing, say, a factor of ten in any direction in a floating
point number wouldn't be a problem! As for the extra errors introduced by
rewriting expressions, this wouldn't be a problem: if one needs total
control over floating point, there's no reason to use -ffast-math!
Jeremy Sanders <firstname.lastname@example.org> http://www-xray.ast.cam.ac.uk/~jss/
Pembroke College, Cambridge. UK Institute of Astronomy, Cambridge. UK