This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What is acceptable for -ffast-math? (Was: associative law in combine)
- To: gdr at codesourcery dot com, nick at ing-simmons dot net
- Subject: Re: What is acceptable for -ffast-math? (Was: associative law in combine)
- From: dewar at gnat dot com
- Date: Fri, 3 Aug 2001 17:48:42 -0400 (EDT)
- Cc: amylaar at redhat dot com, aoliva at redhat dot com, dewar at gnat dot com,gcc at gcc dot gnu dot org, moshier at moshier dot ne dot mediaone dot net,torvalds at transmeta dot com, tprince at computer dot org
Stephen says
> I'm writing agricultural simulations[1], and I'd be happy to get
> transformations enabled with -ffast-math that would be safe with real
> numbers, but not with floating point numbers.
Well that's at least a coherent position, but I am afraid that no one would
really accept this criterion. for example, this would allow replacing:
(a*b) / (c*d)
by
(a * b * 10.0**1000) / (c * d * 10.0**10000)
and introduce overflow where none was expected, and if you think such
a transformation is just obviously unreasonable consider:
x := b * 10.0**1000;
y := d * 10.0**1000;
now compute (a*b) / (c*d)
and to improve efficiency transform this to (a*x)/(c*y), since x and y
happen to be available in registers
Now you might be inclined to say, OK, "transformations that would be safe
with real numbers providing they do not introduce overflow".
But you don't mean that, because many of the transformations we have
discussed introduce overflow in "marginal" cases, and now we are back in
undefined territory.