当Integer i = Integer.MAX_VALUE;
i + 1 < i成立,
Double.NaN与任何数(包括自己)比较都为false,与js的NaN一样
如下:
//整数溢出
Integer i = Integer.MAX_VALUE;
System.out.println(i + 1 < i); //true
System.out.println(i + 1); //-2147483648
System.out.println((int) (Math.pow(2, 32) - 1) == Integer.MAX_VALUE); //true
//Double.NaN与任何数(包括自己)比较都为false,与js的NaN一样
double a = Double.NaN;
double b= a;
double c = 1;
System.out.println(a == b); //false
System.out.println(a == Double.NaN); //false
System.out.println(a > b ||a <= b); //false
System.out.println(a > c ||a <= c); //false