In Java, what does NaN mean?

后端 未结 11 2371
时光说笑
时光说笑 2020-11-22 14:00

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

11条回答
  •  温柔的废话
    2020-11-22 14:46

    NaN means “Not a Number” and is basically a representation of a special floating point value in the IEE 754 floating point standard. NaN generally means that the value is something that cannot be expressed with a valid floating point number.

    A conversion will result in this value, when the value being converted is something else, for example when converting a string that does not represent a number.

提交回复
热议问题