This is the mail archive of the 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. wrote:

> <<I think what Toon meant was something like: if you throw all the
> possible distinct values for a given FP representation into a sack, and
> pick the operands at random from the sack, there's roughly a 50/50
> chance that B*C will overflow or underflow.
> >>

> I agree that's what he meant, but that is entirely wrong, the proportion
> of numbers that overflow is far far smaller. Remember we are talking about
> floating-point values here, not real values. There are as many fpt
> numbers with an exponent of 1 as there are with an exponent of 100 :-)

Robert, I think you'll have to do that analysis somewhat slower, because
I can't follow it.  I agree my original analysis of A/B/C -> A/(B*C) was
wrong, because I didn't consider the value of A.

However, if we just look at B*C then this product will overflow or
underflow when the the sum of the exponents of B and C is higher than +N
or lower than -N.  If we take B and C randomly from the FP-values-sack,
that will be true for half of the exponent values.  Because there are
the same number of fp values for every exponent value, it follows that
the conclusion extends to "half of the fp values".

Toon Moene - - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77:
Join GNU Fortran 95: (under construction)

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