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: gcc at gcc dot gnu dot org
- Subject: Re: Draft "Unsafe fp optimizations" project description.
- From: Ross Smith <ross dot s at ihug dot co dot nz>
- Date: Mon, 06 Aug 2001 08:13:59 +1200
- Organization: Ihug
- References: <20010805123250.86999F2B7A@nile.gnat.com>
dewar@gnat.com 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 :-)
On further consideration, I think we were all wrong :-) The probability
of an overflow or underflow is actually 25% give or take a smidgeon.
(Hint: The logarithms of FP numbers are approximately uniformly
distributed.)
--
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
"Unix has always lurked provocatively in the background of the operating
system wars, like the Russian Army." -- Neal Stephenson