什么

解决方案 »

  1.   

    不会的,会得到正负无穷,以及NaN(Not A Number)。其中尤以Double.NaN最为有趣,你可以尝试将其与自己,或者其他数进行大小等于比较See also java.lang.Double/Float.java
    public final class Double extends Number implements Comparable<Double> {
        /**
         * A constant holding the positive infinity of type
         * <code>double</code>. It is equal to the value returned by
         * <code>Double.longBitsToDouble(0x7ff0000000000000L)</code>.
         */
        public static final double POSITIVE_INFINITY = 1.0 / 0.0;    /**
         * A constant holding the negative infinity of type
         * <code>double</code>. It is equal to the value returned by
         * <code>Double.longBitsToDouble(0xfff0000000000000L)</code>.
         */
        public static final double NEGATIVE_INFINITY = -1.0 / 0.0;    /** 
         * A constant holding a Not-a-Number (NaN) value of type
         * <code>double</code>. It is equivalent to the value returned by
         * <code>Double.longBitsToDouble(0x7ff8000000000000L)</code>.
         */
        public static final double NaN = 0.0d / 0.0;
      

  2.   

    所以判断一个数是否为NaN的方法不是a == Double.NaN;而是Double.isNaN(a) 或者 a != a;