RFR: JDK-8301205: Port fdlibm log10 to Java

Raffaello Giulietti rgiulietti at openjdk.org
Fri Jan 27 13:50:25 UTC 2023


On Fri, 27 Jan 2023 13:45:18 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> Restarting the port of FDLIBM to Java with the log10 method.
>> 
>> There are two port, the first a near-transliteration from C port to use as a test reference in
>> 
>> test/jdk/java/lang/StrictMath/FdlibmTranslit.java
>> 
>> and a more idiomatic Java port in 
>> 
>> src/java.base/share/classes/java/lang/FdLibm.java
>> 
>> First I debug the FdlibmTranslit port by running it against the C version. Once that is working, I copy the port into the java.lang.FdLibm.java and do a series of transformation to get the code closer to usual JDK style.
>
> src/java.base/share/classes/java/lang/FdLibm.java line 820:
> 
>> 818:             hx = (hx & 0x000f_ffff) | ((0x3ff - i) << 20);
>> 819:             y  = (double)(k + i);
>> 820:             x = __HI(x, hx);
> 
> `            x = __HI(x, hx);  // replace high word of x with hx`

Otherwise LGTM

-------------

PR: https://git.openjdk.org/jdk/pull/12242


More information about the core-libs-dev mailing list