JDK-8262030 : win_x86-32 Math.exp not producing Infinity when expected
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 11,15,16,17
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: x86
  • Submitted: 2021-02-19
  • Updated: 2021-02-23
  • Resolved: 2021-02-19
Related Reports
Duplicate :  
Description
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

Comments
Ah yeah, sorry my misstake, I meant to do the other one!
23-02-2021

[~aleonard] would you mind requesting the backport on JDK-8255368 as this was the item that got fixed? This bug is only its duplicate. Thanks!
22-02-2021

Fix Request Backporting this patch fixes a problem with Math.exp() giving wrong results for very large numbers on x86 (32 bit). The patch was directly exported from openjdk/jdk and applies cleanly to 11u. Running tier1 tests on Windows did not yield additional test failures and the test included in the patch passes, too. The patch corrects the x86 intrinsic of Math.exp() and should therefore have a small impact.
22-02-2021

Duplicate of JDK-8255368.
19-02-2021