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: Draft "Unsafe fp optimizations" project description.


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>


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