Is there a floating point value of x, for which x-x == 0 is false?
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. edit: I'm happy to pick an answer if someone can cite a reference (IEEE floating point standard)? As you hinted, inf - inf is NaN , which is not equal to zero. Similarly, NaN - NaN is NaN . It is true, however, that for