Porposal: Floating-Point Options
Russell Shaw
rjshaw@netspace.net.au
Tue Jun 14 17:56:00 GMT 2005
Robert Dewar wrote:
> Scott Robert Ladd wrote:
>
>> To support different expectations, I suggest defining the following
>> floating-point options for GCC. This is a conceptual overview; once
>> there's a consensus the categories, I'll propose something more formal.
>>
>> -ffp-correct
>>
>> This option focuses code generation on mathematical correctness,
>> portability, and consistency. No 80-bit long doubles, no fsin/fcos,
>> making certain that comparison operators work within reason. Note that
>> this option can only go so far in ensuring portability, given that not
>> every system supports IEEE 754 floats.
>
> It is wrong, confusing, and provocative to call this correct, since
> there is no justification for using this term, and it implies that
> the current behavior of gcc is incorrect, which is not the case.
> Choosing a good name for this is in fact not so easy
...
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.
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.
More information about the Gcc
mailing list