一个简单的例子是
double d = Double.NaN; // ordouble d = 0.0/0.0; // ordouble d = Double.POSITIVE_INFINITY + Double.NEGATIVE_INFINITY;if (Double.isNaN(a)) { // tests if a != a // do something
BTW Double.compare()确实将NaN视为相等
if (Double.compare(d, d) == 0) // always.
if (a != a) { // a thread changed a while you were looking at it.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)