Java Math.exp (double) vs StrictMath.exp (double)

I have a very simple test case Javathat calls Math.exp(double), and then StrictMath.exp(double)for some reason, I can’t understand that the result is different from Java 8, despite the fact that JDKit Math.expjust delegates from the source code StrictMath.exp.

public static void main(String[] args) {
    Properties p = System.getProperties();
    System.out.println(p.get("java.runtime.version"));
    System.out.println(p.get("java.specification.version"));
    System.out.println(Math.exp(1d));
    System.out.println(StrictMath.exp(1d));
}

result Java 8:

1.8.0_66-b18
1.8
null
2.718281828459045
2.7182818284590455

and Java 7:

1.7.0_21-b11
1.7
2.7182818284590455
2.7182818284590455

Any pointers appreciated are more out of curiosity than any real issue.

+4
source share
1 answer

This question is essentially the opposite of Joe's question related to: java.lang.Math.log is replaced by an internal call, why not java.lang.Math.exp ()?

6759698e3140 Math.exp() , StrictMath.exp(). (, , Java 8) , Math.exp() , JVM .

Math "" , StrictMath "" . Math StrictMath, , Math , StrictMath, ( ) , StrictMath.

+2

Source: https://habr.com/ru/post/1617059/


All Articles