RFR: 8377223: Port fdlibm atanh to Java

Raffaello Giulietti rgiulietti at openjdk.org
Thu Feb 19 12:48:44 UTC 2026


On Thu, 19 Feb 2026 10:10:43 GMT, Anton Artemov <aartemov at openjdk.org> wrote:

>> 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.

I think what Joe means here is "inlining" these value in the code.

>> 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.

Suggestion:

            hx = __HI(x);                                        // high word

etc.

>> 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.

??? It's still an `if`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29782#discussion_r2827658510
PR Review Comment: https://git.openjdk.org/jdk/pull/29782#discussion_r2827659415
PR Review Comment: https://git.openjdk.org/jdk/pull/29782#discussion_r2827660928


More information about the core-libs-dev mailing list