Is there a floating point value of x, for which x-x == 0 is false?
- by Andrew Walker
In most cases, I understand that a floating point comparison test should be implemented using over a range of values (abs(x-y) < epsilon), but does self subtraction imply that the result will be zero?
// can the assertion be triggered?
float x = //?;
assert( x-x == 0 )
My guess is that nan/inf might be special cases, but I'm more interested in what happens for simple values.