【发布时间】:2013-08-28 20:19:33
【问题描述】:
我在看openjdk-1.7.0_25源代码,看到了这个方法:
/**
* Returns {@code true} if the specified number is a
* Not-a-Number (NaN) value, {@code false} otherwise.
*
* @param v the value to be tested.
* @return {@code true} if the argument is NaN;
* {@code false} otherwise.
*/
static public boolean isNaN(float v) {
return (v != v);
}
我不明白它是怎么工作的,这个方法什么时候可以返回true?
【问题讨论】:
标签: java floating-point nan