RT

解决方案 »

  1.   

            double i = Double.NaN;
            System.out.println(i!=i);$ java Example 
    true

      

  2.   

    楼上所言极是http://hi.baidu.com/freish/blog/item/d45b9182352796b56d81196b.html
      

  3.   

    Float也可以
    Float i = Float.NaN;
    System.out.println(i != i);
      

  4.   

    错了,float不行,以为浮点类型都可以,因为精度问题,可能会导致不一样
      

  5.   

    Float是可以的
    float i = Float.NaN;
    System.out.println(i != i);
      

  6.   


    正解看到标题,我正准备来回的,发现你已经回来了NaN != NaN 的
      

  7.   

    竟然有这么多人不知道NaN不相等的问题....明显读书的时候都不专心啊....
      

  8.   

    NaN。
    NaN不等于任何值,包括自身。
    《java解惑》一书中有详细的叙述。
      

  9.   

    NaN 在 IEEE 754 浮点数标准中是一个值,表示的是 0/0 的值。
      

  10.   

    NaN (Not a Number) is a value of numeric data type representing an undefined or unrepresentable value, especially in floating-point calculations. Systematic use of NaNs was introduced by the IEEE 754 floating-point standard in 1985, along with the representation of other non-finite quantities like infinities.