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

wrong conversion of floating-point to integral types in Windows

    XMLWordPrintable

Details

    • 1.1
    • sparc
    • solaris_2.4
    • Not verified

    Description



      Name: swC45995 Date: 10/07/96


      In Windows java incorrectly converts floating-point values to integral types.
      In particular, NaN is not converted to zero, the maximum double value is
      converted to the minimum long value and zeros of other integral types, etc.
      Thus execution of the following test:

      public class test
      {
      public static void main(String argv[])
      {
      System.out.println((byte) Float.MAX_VALUE);
      System.out.println((short) Float.MAX_VALUE);
      System.out.println((int) (char) Float.MAX_VALUE);
      System.out.println((int) Float.MAX_VALUE);
      System.out.println((long) Float.MAX_VALUE);
      System.out.println((long) Float.MAX_NaN);
      }
      }

      produces the following results:

      0
      0
      0
      0
      -9223372036854775808
      -9223372036854775808

      instead of expected:

      -1
      -1
      65535
      2147483647
      9223372036854775807
      0

      For double values the results will be the same.

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

      Attachments

        Issue Links

          Activity

            People

              egilbertsunw Eric Gilbertson (Inactive)
              wensunw Wen Wen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: