Subject: Re: [geometry] warning: comparing floating point with == or != is unsafe
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-06-07 14:18:21
On 7-6-2013 4:46, Adam Wulkiewicz wrote:
> Mateusz Loskot wrote:
>> On 7 June 2013 01:36, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]> wrote:
>>> Ah, I've forgotten to handle this after porting it from the old
>>> Thanks for digging this up. Yes, there should probably be comparison
>> You may try GCC/clang with -Wfloat-equal, there is a few more, but those
>> need to be addressed individually, I think.
>> So, we may discuss unobvious cases.
> In the Index there are comparisons in:
> but they're ok.
> And I've detected also the one in:
That one first compares with == indeed. If that is true, it returns true
(whatever the epsilon is, if == returns true, it will always return
true). If == is false, it does a more sophisticated comparison, still
intended to be replaced by some Boost utility. See the comments. There
are still some issues with this (not exactly with this, but with FP in
Geometry list run by mateusz at loskot.net