This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: /internet
On Wed, Dec 16, 1998 at 05:34:47PM -0700, Jeffrey A Law wrote:
> [...] Though
> I believe in the case reassociating a series of multiplies we are safe.
>
> I challenge anyone to come up with a case where a reassociation of
> a * b * c * d produces different results than ((a * b) * c) * d.
If you want that, you'd better first _prove_ that it works in every case.
But you won't be able to do so because it's false.
It might be true when the following both conditions are met:
- no intermediate overflow/underflow appears (nor denormalized numbers).
- the rounding mode is set to nearest.
I'd be interested in reading the proof in this case (if it's true).
Case if you have an intermediate overflow is easy:
DBL_MAX * DLB_MAX * DBL_MIN gives you either Inf or DBL_MAX.
Case when rounding is set to +Infinity:
0.1 * 0.1 * -1.0 doesn't give you the same result, try it.
--
Sylvain