C++ FAQ Celebrating Twenty-One Years of the C++ FAQ!!!
(Click here for a personal note from Marshall Cline.)
Section 29:
[29.14] Is !(a < b) logically the same as a >= b?


Despite what your grade school math teacher taught you, these equivalences don't always work in software, especially with floating point expressions or user-defined types.

Example: if a is a floating point NaN, then both a < b and a >= b will be false. That means !(a < b) will be true and a >= b will be false.

Example: if a is an object of class Foo that has overloaded operator< and operator>=, then it is up to the creator of class Foo if these operators will have opposite semantics. They probably should have opposite semantics, but that's up to whoever wrote class Foo.