This sort of thing is why you never compare floating point numbers for equality. Always compare using epsilons appropriately chosen for the circumstances.
Always... except when you're actually writing floating point operations. If I'm implementing `sqrt`, I'd better make sure the result is exactly the expected one. Epsilon is 0 in all my unit tests. ;)
This is true! As an implementor of floating point operations, you want to be exactly correct for all values (glares at Intel :P ) However, as a consumer of said floating point operations, I'm still gonna treat everything as Sneaky And Not To Be Trusted. :P Especially in C++ where this attribute is largely supplied by the compiler being /r/iamverysmart about this sort of thing.