When does java print Infinity and when does it print NaN?
Why is 1.0/0.0 infinity but ((1.0/0.0) - (1.0/0.0)) NaN and 0.0f/0.0f an NaN?
What is the differenc
1.00/0 goes infinity but infinity minus infinity is not a number.
Because Java is following known math facts. 1.0 / 0.0 is infinity, but the others are indeterminate forms, which Java represents as NaN
(not a number).
Java's just following the IEEE 754 specification, which is consistent with most floating-point hardware nowadays.