Openjdk-tests: jdk11 win_x86-32 hotspot Math.exp expected result Infinity, actual result 0.0

Created on 19 Nov 2020  路  10Comments  路  Source: AdoptOpenJDK/openjdk-tests

Found this while working on https://github.com/AdoptOpenJDK/openjdk-systemtest/issues/376. Math.exp on the win_x86-32 hotspot jdk11 or later builds is returning 0.0 rather than Infinity. StrictMath.exp returns Infinity as expected.

Test case:

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));
    }
}

Running on win_x86-32 hotspot jdk8 (or any other other platform, release or openj9):

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

Running on win_x86-32 hotspot jdk11 or jdk15::

>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

Since win_x86-32 hotspot is not supported at jdk11 or later this is unlikely to be fixed upstream.

I will avoid executing this particular test on win_x86-32 jdk11 or later as part of the fix for https://github.com/AdoptOpenJDK/openjdk-systemtest/issues/376.

JBS ReporteFixed Upstream

All 10 comments

There are some spin off systemtest PRs from this, what other actions are to happen from this, does an upstream issue need to be raised?

@smlambert If you can create a JBS issue, that would be great. I've looked into fixing it. It will likely result in the removal of the 32 bit intrinsic, except somebody knows somebody at Intel who can provide updated libm source code (that's where the assembler code originally comes from).

@aahlenst i'll raise a bug

@aahlenst @ShelleyLambert it hasn't been backported to 11... would you like me to backport?

If it looks straight-forward that would be sensational! I was about to verify the math tests from the openjdk group to see if we had excluded the test, and if I need to update the link to the exclude... even better if its fixed and re-included!

Backport has just landed in 11u-dev, should become part of 11.0.11.

@karianna You were too fast. The tests need to be re-enabled, first.

Was this page helpful?
0 / 5 - 0 ratings