[cfe-commits] r44058 - in /cfe/trunk: Sema/SemaExpr.cpp test/Sema/floating-point-compare.c
Chris Lattner
clattner at apple.com
Wed Nov 14 12:56:44 PST 2007
On Nov 14, 2007, at 3:36 AM, Neil Booth wrote:
> Ted Kremenek wrote:-
>
>>> More generally, should it be suppressed for comparisons against
>>> any FP constant that is exact as written?
>>>
>>> Neil.
>>
>> I'm not certain. Also, I wonder if the following two cases should be
>> treated separately:
>>
>> x == 0.0
>>
>> and
>>
>> x == 3.14159 (or any non-zero constant)
>>
>> The first case still isn't really kosher either, but suppressing
>> warnings for explicit tests against 0.0 probably will suppress more
>> false positives than the number of false negatives it will cause.
>
> Indeed, and same for 1.0 and -1.0 etc. All those numbers are exact
> as written.
>
>> I think the second case is far more likely to be an error.
>
> 3.14159 is not exact as written so would be diagnosed under my
> proposal.
This is an interesting proposal. Is there any way to tell that the
value is inexact?
-Chris
More information about the cfe-commits
mailing list