In Java, what does NaN mean?

后端 未结 11 2268
时光说笑
时光说笑 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:42

    Taken from this page:

    "NaN" stands for "not a number". "Nan" is produced if a floating point operation has some input parameters that cause the operation to produce some undefined result. For example, 0.0 divided by 0.0 is arithmetically undefined. Taking the square root of a negative number is also undefined.

提交回复
热议问题