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

Win32 only: Converting Double.MAX_VALUE -> long returns Long.MIN_VALUE

XMLWordPrintable

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

      Win32 only: Converting Double.MAX_VALUE to a long returns Long.MIN_VALUE, it
      should return Long.MAX_VALUE

      Steps to reproduce
      Compile and run the attached code

      See bugs 1240807 & 1229191
      public class JavaConvert
      {
         public static void main (String args[])
         {

            // conversion from double to integer and long
            System.out.println();
            System.out.println("double to integer and long");
            double d = Double.MAX_VALUE;
            int i = (int)d;
            long pl = (long)d;
            System.out.println( "d = " + d );
            System.out.print( "i = " + i );
            System.out.println(" Should be: " + Integer.MAX_VALUE );
            System.out.print("pl = " + pl );
            System.out.println(" Should be: " + Long.MAX_VALUE );

         }
      }

            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: