The difference between infinity and NaN (not a number)

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 NaN?

What is the difference between the two?

+5
source share
3 answers

Because Java follows the well-known mathematical facts. 1.0 / 0.0 infinity , and the rest are indefinite forms , which Java represents as NaN(and not a number).

+7
source

1.00 / 0 goes on forever, but infinity minus infinity is not a number.

+2
source

Java, IEEE 754, .

+1

All Articles