In Java, what does NaN mean?

后端 未结 11 2412
时光说笑
时光说笑 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 15:01

    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).

提交回复
热议问题