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

Win32 only: (double value >= NaN) returns true it should not.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.1
    • 1.0
    • hotspot
    • 1.1
    • x86
    • windows_nt
    • Not verified

      Win32 only: double >= NaN returns true. It should not.
      NaN should not be ordered, so any comparison except != should return false. Same
      problem with Float.NaN.

      Steps to reproduce
      Compile and run the attached code
      Note: you should not see the Warning message.

      public class FloatTest2
      {
         public static void main(String argv[])
         {
            double x = 3.1415926;
            double y = Double.NaN;

            System.out.println( "x == " + x );
            System.out.println( "y == " + y );
            System.out.println( ! ( x < y ) );
            System.out.println( x >= y );

            if ( (!( x < y ) ) == ( x >= y ) )
               System.out.println( "Warning! !(x<y) should not equal (x>=y)");

         }
      }

            egilbertsunw Eric Gilbertson (Inactive)
            kasmithsunw Kevin Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: