JDK 9 RFR of JDK-8134795: Port fdlibm pow to Java

Joseph D. Darcy joe.darcy at oracle.com
Tue Sep 22 02:44:44 UTC 2015


PS Bug

     JDK-8136874: Bug in port of fdlibm pow to Java
     https://bugs.openjdk.java.net/browse/JDK-8136874

has been filed and I've started working on a fix.

Thanks,

-Joe

On 9/17/2015 9:10 PM, joe darcy wrote:
> Hi Jeff,
>
> Thanks for the bug report; I'll take a look into this,
>
> -Joe
>
> On 9/17/2015 3:12 PM, Jeff Hain wrote:
>> Hi.
>>
>>
>>
>> >At long last, I've started the port of the C version of FDLIBM (freely
>> >distributable math library) from C to Java, beginning with the pow 
>> method:
>>
>>
>> I ran it through tests of my math lib (jafama),
>> and found the following issue:
>>
>> // ok
>>     StrictMath.pow(1.0000000000000004, 2.1E9) = 1.0000009325877754
>> FdLibm.Pow.compute(1.0000000000000004, 2.1E9) = 1.0000009325877754
>>
>> // overflows early
>>     StrictMath.pow(1.0000000000000004, 2.2E9) = 1.0000009769967388
>> FdLibm.Pow.compute(1.0000000000000004, 2.2E9) = Infinity
>>
>> // actual overflow is much further
>>     StrictMath.pow(1.0000000000000004, 1.59828858065033216E18) = 
>> 1.7976931348621944E308
>>     StrictMath.pow(1.0000000000000004, 1.59828858065033242E18) = Infinity
>>
>>
>>
>> Comparing the behavior of your code with that of Eric Blake's StrictMath
>> (the version I got has other issues, but not that one),
>> it could be corrected by replacing
>>
>> if (x_abs > 1.0) {
>>
>> with
>>
>> if (x_abs >= 1.0000009536743164) {
>>
>>
>>
>> After that modification, tests didn't show any difference with 
>> StrictMath.
>>
>>
>>
>> -Jeff
>>
>




More information about the core-libs-dev mailing list