This is the mail archive of the
`gcc@gcc.gnu.org`
mailing list for the GCC project.

# Re: Draft "Unsafe fp optimizations" project description.

*To*: dewar at gnat dot com
*Subject*: Re: Draft "Unsafe fp optimizations" project description.
*From*: Carlo Wood <carlo at alinoe dot com>
*Date*: Sun, 5 Aug 2001 17:20:08 +0200
*Cc*: toon at moene dot indiv dot nluug dot nl, gcc at gcc dot gnu dot org, ross dot s at ihug dot co dot nz
*References*: <20010805150950.CC495F2B79@nile.gnat.com>

On Sun, Aug 05, 2001 at 11:09:50AM -0400, dewar@gnat.com wrote:
> >>Hence the chance is more of the order of 1/MAX instead of 0.5.
>
> I don't buy that reasoning I must say :-)
Well, you don't have to because it is not relevant for the
case A/B/C -> A/(B*C).
What is important there is the number of cases where these
give a *different* result. So, in that case we are talking
about the range of values where sqrt(B*C) is of the order sqrt(1/A)
and it *is* reasonable to assume an evenly distributed value
for the exponent in that limit.
In that case the reasoning of Linus holds unchanged and you
still get in the order of 1/MAX cases where there is a difference.
(Note that MAX is the maximum integer value of an exponent,
ie 65536 if the exponent is 16 bits).
Therefore I think that optimizations like this are certainly
acceptable with -ffast-math... but I think I understood that
this particular optimization was considered for -O2 or something(?).
--
Carlo Wood <carlo@alinoe.com>