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: /internet


> The rules for FP are different becuase it's not 100% certain that the
> results after reassociation will be the same as before reassociation.  Though
> I believe in the case reassociating a series of multiplies we are safe.

Only if the exponent freely overflows and underflows.  However, often you'll
get Inf for an overflow and 0 for an underflow.
And if you come close to an underflow, you might get de-normalized numbers.

> Again, I have no intention of reassociating a + 5 + b + c for FP because of
> overflow concerns.  The same restrictions are not necessary for multiplies
> though as far as I can tell.
> 
> 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.

(DBL_MAX * (DBL_MIN * DBL_MIN)) * 4 is different from
((DBL_MAX * DBL_MIN) * DBL_MIN) * 4


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