Porposal: Floating-Point Options
Russell Shaw
rjshaw@netspace.net.au
Wed Jun 15 02:49:00 GMT 2005
Robert Dewar wrote:
> 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.
But isn't equality broken if it doesn't work because of excess precision?
More information about the Gcc
mailing list