RFR: 8377223: Port fdlibm atanh to Java
Anton Artemov
aartemov at openjdk.org
Thu Feb 19 10:13:04 UTC 2026
On Wed, 18 Feb 2026 20:47:16 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> Hi, please consider the following changes:
>>
>> This is a port of FDLIBM atanh method.
>
> src/java.base/share/classes/java/lang/FdLibm.java line 3631:
>
>> 3629: */
>> 3630: static final class Atanh {
>> 3631: private static final double zero = 0.0;
>
> Earlier refactorings over Fdlibm.java removed use of "zero" and "one" in favor of having those literals in-line (JDK-8304423, etc). I think that would be a good convention to follow here as support for the new method is introduced.
Sure, addressed.
> src/java.base/share/classes/java/lang/FdLibm.java line 3639:
>
>> 3637: int hx,ix;
>> 3638: /*unsigned*/ int lx;
>> 3639: hx = __HI(x); /* high word */
>
> Nit: I'd prefer "//" style comments for the one-liners here.
Addressed.
> src/java.base/share/classes/java/lang/FdLibm.java line 3657:
>
>> 3655: } else
>> 3656: t = 0.5 * Log1p.compute((x + x)/(one - x));
>> 3657: if (hx >= 0) {
>
> Please consider some smaller-vertical space idiom for this, like a use of the ?: construct, etc.
Addressed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29782#discussion_r2826806044
PR Review Comment: https://git.openjdk.org/jdk/pull/29782#discussion_r2826804023
PR Review Comment: https://git.openjdk.org/jdk/pull/29782#discussion_r2826805218
More information about the core-libs-dev
mailing list