Thursday, July 11, 2013

How do you test to see if a double is equal to NaN in Java?

Use the static Double.isNaN(double) method, or your Double's .isNaN() method.
Simply doing:
if (var == Double.NaN) {
    ...
}

Reference:
http://stackoverflow.com/questions/1456566/how-do-you-test-to-see-if-a-double-is-equal-to-nan-in-java

0 comments:

Post a Comment