I have a program that tries to shrink a double
down to a desired number. The output I get is NaN
.
What does NaN
mean in Java?
I have a program that tries to shrink a double
down to a desired number. The output I get is NaN
.
What does NaN
mean in Java?
Taken from this page:
NaN = Not a Number.
NaN
means "Not a Number" and is the result of undefined operations on floating point numbers like for example dividing zero by zero. (Note that while dividing a non-zero number by zero is also usually undefined in mathematics, it does not result in NaN but in positive or negative infinity).NaN
means "Not a number." It's a special floating point value that means that the result of an operation was not defined or not representable as a real number.See here for more explanation of this value.
Not a Java guy, but in JS and other languages I use it's "Not a Number", meaning some operation caused it to become not a valid number.
Means Not a Number. It is a common representation for an impossible numeric value in many programming languages.