boostorg / polygon

Boost.org polygon module
http://boost.org/libs/polygon
57 stars 70 forks source link

isnan() tests on all recomputeX ulp comparisons. #62

Closed eadf closed 3 years ago

eadf commented 3 years ago

NaN > ULPS will always be false and that will prevent the position recalculation.

This PR will prevent erroneous results from issues like #48.

I honestly don't know if #include <cmath> is required. isnan() is part of C++11 and higher.

eadf commented 3 years ago

Im not so sure that the err_ field of robust_fpt actually can ever become NaN, so there is no need for this PR.

And I don't think Issue #48 is an issue at all, it looks like err_ intentionally becomes Infinity whenever a subtraction results in zero.

There are, however, places in robust_fpt where I think err_ should be set to infinity. E.g. 0/0 will happily add a default err_ value where infinity would be more correct.