Porposal: Floating-Point Options
Robert Dewar
dewar@adacore.com
Tue Jun 14 21:22:00 GMT 2005
Russell Shaw wrote:
> The original bug was about testing the equality of doubles. I think that's
> just plain mathematically bad. Error bands should be used to test for
> "equality", using a band that is in accordance with the minimum precision
> specified in the compiler documentation.
That's often taught, but in fact there are many IEEE algorithms where it
makes perfectly good sense to test for absolute equality.
>
> OTOH, maybe the equality operators should discard the excess precision, so
> effectively implementing the error band anyway. Can't say more without
> reading
> the relevant standards. If the equality operators did this, then it
> shouldn't
> slow down any non-equality operators or anything else.
But it would, quite unnecessarily, slow down equality.
More information about the Gcc
mailing list