RFR: JDK-8301392: Port fdlibm log1p to Java
Andrey Turbanov
aturbanov at openjdk.org
Tue Jan 31 06:52:00 UTC 2023
On Tue, 31 Jan 2023 02:52:45 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> Another day, another PR to port FDLBIM to Java, this time for the log1p method.
>
> Other than using the two-argument form of the __HI method in Java transliteration version rather than C macro, there are no appreciable differences between the original C source in
>
> src/java.base/share/native/libfdlibm/s_log1p.c
>
> and the transliteration for testing purposes in
>
> test/jdk/java/lang/StrictMath/FdlibmTranslit.java
>
> The more idiomatic port in
>
> src/java.base/share/classes/java/lang/FdLibm.java
>
> has had a series of transformation applied layering on the transliteration. The intermediate commits show the progress.
>
> The regression tests include probing around input values the implementation uses to decided which branch to take.
src/java.base/share/classes/java/lang/FdLibm.java line 785:
> 783: private static double ivln10 = 0x1.bcb7b1526e50ep-2; // 4.34294481903251816668e-01
> 784:
> 785: private static double log10_2hi = 0x1.34413509f6p-2; // 3.01029995663611771306e-01;
Are this constants intentionally not `final` ?
src/java.base/share/classes/java/lang/FdLibm.java line 911:
> 909: k = 1;
> 910: if (hx < 0x3FDA827A) { /* x < 0.41422 */
> 911: if(ax >= 0x3ff00000) { /* x <= -1.0 */
Suggestion:
if (ax >= 0x3ff00000) { /* x <= -1.0 */
test/jdk/java/lang/StrictMath/Log1pTests.java line 235:
> 233:
> 234: // ... and just below subnormal threshold ...
> 235: x = Math.nextDown(Double.MIN_NORMAL);
Suggestion:
x = Math.nextDown(Double.MIN_NORMAL);
-------------
PR: https://git.openjdk.org/jdk/pull/12301
More information about the core-libs-dev
mailing list