O'Reilly logo
  • Muhammad Umair thinks this is interesting:

Double.POSITIVE_INFINITY for ∞, Double.NEGATIVE_INFINITY for –∞, and Double.NaN for “not a number.” For example, the result of computing 1.0 / 0.0 is positive infinity. Computing 0.0 / 0.0 or the square root of a negative number yields NaN.


Image Caution

All “not a number” values are considered to be distinct from each other. Therefore, you cannot use the test if (x == Double.NaN) to check whether x is a NaN. Instead, call if (Double.isNaN(x))<...

From

Cover of Core Java® for the Impatient

Note

special for doubles