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

win_x86-32 Math.exp not producing Infinity when expected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 11, 15, 16, 17
    • core-libs
    • None
    • x86
    • windows

      Math.exp on the win_x86-32 jdk11 or later builds is returning 0.0 rather than Infinity. StrictMath.exp returns Infinity as expected.

      public class MathTest {

      public static void main(String[] args) {
      System.out.println("StrictMath.exp(18232155.3323566D) = " + StrictMath.exp(18232155.3323566D));
      System.out.println("Math.exp(18232155.3323566D) = " + Math.exp(18232155.3323566D));
      System.out.println("StrictMath.exp(Double.MAX_VALUE / 500) = " + StrictMath.exp(Double.MAX_VALUE / 500));
      System.out.println("Math.exp(Double.MAX_VALUE / 500) = " + Math.exp(Double.MAX_VALUE / 500));
      System.out.println("StrictMath.exp(Double.MAX_VALUE / 200) = " + StrictMath.exp(Double.MAX_VALUE / 200));
      System.out.println("Math.exp(Double.MAX_VALUE / 200) = " + Math.exp(Double.MAX_VALUE / 200));
      System.out.println("StrictMath.exp(Double.MAX_VALUE) = " + StrictMath.exp(Double.MAX_VALUE));
      System.out.println("Math.exp(Double.MAX_VALUE) = " + Math.exp(Double.MAX_VALUE));
      System.out.println("StrictMath.exp(Double.MAX_VALUE + 1) = " + StrictMath.exp(Double.MAX_VALUE + 1));
      System.out.println("Math.exp(Double.MAX_VALUE + 1) = " + Math.exp(Double.MAX_VALUE + 1));
      }
      }

      >C:\openjdkjava\win_x86-32\jdk-11.0.9.1+1\bin\java -cp . MathTest
      StrictMath.exp(18232155.3323566D) = Infinity
      Math.exp(18232155.3323566D) = 0.0
      StrictMath.exp(Double.MAX_VALUE / 500) = Infinity
      Math.exp(Double.MAX_VALUE / 500) = 0.0
      StrictMath.exp(Double.MAX_VALUE / 200) = Infinity
      Math.exp(Double.MAX_VALUE / 200) = 0.0
      StrictMath.exp(Double.MAX_VALUE) = Infinity
      Math.exp(Double.MAX_VALUE) = 0.0
      StrictMath.exp(Double.MAX_VALUE + 1) = Infinity
      Math.exp(Double.MAX_VALUE + 1) = 0.0

            darcy Joe Darcy
            aleonard Andrew Leonard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: