Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4007659

wrong comparison involving NaN values in Windows

XMLWordPrintable

    • 1.1fcs
    • sparc
    • solaris_2.4
    • Not verified



      Name: swC45995 Date: 10/07/96


      In Windows java incorrectly performs comparison operations involving NaN
      values. For example, execution of the following test:

      public class test
      {
      public static void main(String argv[])
      {
      float zero = 0.0f;

      System.out.println(zero >= Float.NaN == !(zero < Float.NaN));
      System.out.println(Float.NaN > 3.14f);
      System.out.println(Float.NaN >= 12.63d);
      System.out.println(Double.MIN_VALUE <= Float.NaN);
      System.out.println(Float.NaN > Double.NaN);
      }
      }

      produces the following results:

      true
      true
      true
      true
      true

      instead of expected:

      false
      false
      false
      false
      false

      ======================================================================



      As of 1.1beta2, the output of this test on WinNT is:

      true
      false
      false
      false
      false

      That is, better, but not fixed yet.

      timothy.lindholm@Eng 1996-12-16

            sliangsunw Sheng Liang (Inactive)
            wensunw Wen Wen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: