RFR: 8376665: Port fdlibm acosh to Java [v7]

Anton Artemov aartemov at openjdk.org
Thu Feb 12 08:45:18 UTC 2026


On Wed, 11 Feb 2026 14:05:34 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> Anton Artemov has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - 8376665: Stylistical fixes.
>>  - 8376665: Stylistical fixes.
>
> src/java.base/share/classes/java/lang/FdLibm.java line 3573:
> 
>> 3571:      *      acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -∞ < alpha < &infin
>> 3572:      *      and cosh(acosh(x)) = x, 1 <= x  < &infin.
>> 3573:      *      It can be written as acosh(x) = ln(x + sqrt(x^2 - 1)), 1 <= x  < &infin.
> 
> It's `∞` with a semicolon, like any HTML entity name.
> Also, replace `<` with `<`

Noted.

> src/java.base/share/classes/java/lang/FdLibm.java line 3574:
> 
>> 3572:      *      and cosh(acosh(x)) = x, 1 <= x  < &infin.
>> 3573:      *      It can be written as acosh(x) = ln(x + sqrt(x^2 - 1)), 1 <= x  < &infin.
>> 3574:      *      acosh(x) := log(x)+ln2, if x is large; else
> 
> Using both log and ln in the same context might be confusing. Consistency would be welcome.

Fixed.

> src/java.base/share/classes/java/lang/Math.java line 2793:
> 
>> 2791:      * Returns the inverse hyperbolic cosine of a {@code double} value.
>> 2792:      * The inverse hyperbolic cosine of <i>x</i> is defined to be the function such that
>> 2793:      *  acosh({@linkplain Math#cosh cosh(<i>x</i>)}) = <i>x</i> for any <i>x >= 0</i>.
> 
> Suggestion:
> 
>      *  acosh({@linkplain Math#cosh cosh(<i>x</i>)}) = <i>x</i> for any <i>x</i> >= 0.

Fixed.

> src/java.base/share/classes/java/lang/StrictMath.java line 2202:
> 
>> 2200:      * Returns the inverse hyperbolic cosine of a {@code double} value.
>> 2201:      * The inverse hyperbolic cosine of <i>x</i> is defined to be the function such that
>> 2202:      *  acosh({@linkplain Math#cosh cosh(<i>x</i>)}) = <i>x</i> for any <i>x >= 0</i>.
> 
> Suggestion:
> 
>      *  acosh({@linkplain Math#cosh cosh(<i>x</i>)}) = <i>x</i> for any <i>x</i> >= 0.

Fixed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2797505752
PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2797506130
PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2797506562
PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2797507016


More information about the core-libs-dev mailing list