|
|
|
|
|
by TeMPOraL
2084 days ago
|
|
Floating point comparison is a bottomless pit. This article goes into details: https://randomascii.wordpress.com/2012/02/25/comparing-float... In particular, in many cases, you want to consider alternatives to comparing against a fixed epsilon: the relative epsilon approach, and the ULP (Units in the Last Place) method, which tests for how many other floats/doubles are representable between two values you're comparing. The benefit of these two methods is that they scale with the compared numbers. |
|