Taking the square root of a negative number is also undefined. NaN operations involving nan Double. All boolean operations involving NaN result in a false value. NaN false Double. NaN false Float.
Infinity is a special value that represents the concept of positive infinity.
However, some operations involving -0.0 are different than the same operation with 0.0 . Comparing two Java Float objects can have different semantics than comparing two Java float values. A NaN value is not equal to itself. However, a NaN Java Float object is equal to itself. The semantic is defined this way, because otherwise NaN Java Float objects cannot be retrieved from a hash table.