The result of Math.log(3.0) is different on x86_64 and aarch64?

Joe Darcy joe.darcy at oracle.com
Mon Jul 29 18:26:50 UTC 2019


tl;dr if you need reproduciblity, use StrictMath.log rather than Math.log.

Also note that this alias is a broad alias for the development of the 
JDK; it is not a support alias or dedicated forum to submit bugs.

IMO, this thread is off-topic for this alias and such inquiries would be 
better directed to a bug reporting location, such as 
https://bugreport.java.com/bugreport/, or elsewhere.

Cheers,

-Joe

On 7/25/2019 1:11 AM, Tianhua huang wrote:
> Sorry to disturb you again, I took some tests of java.lang.Math.log
> function on aarch64 server, I met a strange case, the result of
> Math.log(3.0) is different with x86_64:
> on x86_64:
> scala> Math.log(3.0) res50: Double = 1.0986122886681098
>
> but on aarch64:
> scala> Math.log(3.0) res19: Double = 1.0986122886681096
>
> Then I tried  Math.log(4.0), Math.log(5.0) and some other numbers, the
> results on x86_64 and aarch64 are same, why Math.log(3.0) is so special?
> this confused me much, I think the result of
> Math.log(Double) should be same across platforms, right?


More information about the jdk-dev mailing list