Last active
June 25, 2018 16:22
-
-
Save hellojinjie/5873787 to your computer and use it in GitHub Desktop.
Java 中判断 Double 是不是 NaN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 哼,这是个坑,我会跟你说嘛。。。 | |
Double num = Double.NaN | |
// :( | |
if (num == Double.NaN) { | |
System.out.println(num); | |
} | |
// :) | |
if (Double.isNaN(num)) { | |
System.out.println(num); | |
} | |
==
is not always ok.
后一个好用
yep
哈哈,谢谢~
前来考古,谢谢
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks~