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

Andrew Dinn adinn at redhat.com
Mon Jul 29 09:29:33 UTC 2019


Hi Zhaobo,

Thank you for reporting this problem. Could you please provide details
of the version of OpenJDK you are using on both AArch64 and x86_64?

regards,


Andrew Dinn

On 27/07/2019 02:13, bo zhaobo wrote:
> Hi team, any idea about this issue? Please help to solve or location.
> 
> Thank you
> 
> ZhaoBo
> 
> 
> 
> [image: Mailtrack]
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&>
> Sender
> notified by
> Mailtrack
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&>
> 19/07/27
> 上午09:12:05
> 
> Tianhua huang <huangtianhua223 at gmail.com> 于2019年7月25日周四 下午5:54写道:
> 
>> In fact, we found the differences when we took tests of apache/spark,
>> there are some related tests failed.
>>
>> And till now we also found the results for 'power' function is different
>> between x86_64 and aarch64 for some cases, for an example:
>>
>> on x86_64:
>>
>> scala> import java.lang.Math._ import java.lang.Math._ scala>
>> abs(-83028485) res3: Int = 83028485 scala> var a = -83028485 a: Int =
>> -83028485 scala> abs(a) res4: Int = 83028485 scala> math.log(abs(a)) res5:
>> Double = 18.234694299654787 scala> pow(10, math.log(abs(a))) res6: Double =
>> *1.71669957511859584E18*
>>
>> on aarch64:
>> scala> var a = -83028485 a: Int = -83028485 scala> abs(a) res38: Int =
>> 83028485 scala> math.log(abs(a)) res39: Double = 18.234694299654787 scala>
>> pow(10, math.log(abs(a))) res40: Double = *1.71669957511859558E18*
>>
>> So the algorithm of these math functions(power, log, maybe there are
>> others) is different on platforms? How or where I can find these
>> information? Could anyone help us? Thank you very much.
>> I don't know the behavior is correct or not, or maybe the tests of spark
>> is not appropriate?
>>
>>
>>
>>
>> On Thu, Jul 25, 2019 at 4:11 PM Tianhua huang <huangtianhua223 at gmail.com>
>> 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?
>>>
>>>
> 

-- 
regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander


More information about the jdk-dev mailing list