Closed Jaaaky closed 1 year ago
This is wrong.
The idea that it is never meaningful to compare floating-point numbers for exact equality is a myth. And replacing x == y
with |x - y| < ε
is even worse, because it is confusing floating-point arithmetic with fixed-point arithmetic (it is assuming your numbers have a scale of unity).
If there is an individual place in the code where it can be argued that the exact equality check is an error, then we can discuss what would be a more appropriate check on a case-by-case basis. But a blanket search-and-replace like this will introduce more bugs than it fixes.
Implement nlopt_isequal() and nlopt_iszero() functions for help Partially fixes #519