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

Linux: Incorrect floating-point calculations in JDK 1.3

XMLWordPrintable

    • linux-beta
    • x86
    • linux
    • Verified



      Name: iaR10016 Date: 05/04/2000



      JDK version:
      java version "1.3.0beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b03)
      Java HotSpot(TM) Client VM (build 1.3.0beta-b01, mixed mode)

      The following test example shows the incorrect floating-point
      calculations in JDK 1.3.

      Correct result for (double)(1.1107651257113993E-16+1.) is
      1.0000000000000002.

      If the test runs with -Xcomp option, the result of calculations is
      correct on
      single-processor system and incorrect on multy-processor system.

      In Linux JDK 1.2.2 and in Solaris JDK 1.2.2, 1.3 the result is correct.

      ------------------ test.java ----------------------------------

      public class test {
          public static void main (String args[]) {
              double x = 1.1107651257113993E-16;
              double y = 1.;
              System.out.println(x+y);
          }
      }

      --------------- Output (Solaris JDK 1.3) ----------------------

      Correct result:

      $ java test
      1.0000000000000002
      $

      ---- Output (Linux JDK 1.3, multy-processor system) -----------

      Incorrect result:

      $ java test
      1.0
      $ java -Xint test
      1.0
      #
      # HotSpot Virtual Machine Error, Unexpected Signal 11
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Error ID: 4F533F4C494E55580E43505005D8
      #
      # Problematic Thread: prio=1 tid=0x8097388 nid=0x400 runnable
      #
      $ java -Xcomp test
      1.0
      $

      ------ Output (Linux JDK 1.3, single-processor system) --------

      Incorrect result:

      $ java test
      1.0
      $ java -Xint test
      1.0


      Correct result:

      $ java -Xcomp test
      1.0000000000000002
      $

      JCK 1.3 compiler tests /lang/FP/lang/FP/fpl035/fpl03502m2/fpl03502m2
      and lang/FP/fpl035/fpl03502m4/fpl03502m4 fail if Linux JDK 1.3 because
      of this bug.

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

            hongzh Hong Zhang
            irasunw Ira Ira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: