Hi, please consider the following changes: This is a port of FDLIBM acosh method. Original C vs transliteration port: $ diff -w fdlib_acosh.c.txt Acosh.translit.java 1c1,3 < /* __ieee754_acosh(x) ---
/** * Return the Inverse Hyperbolic Cosine of x * 7,8c9,10 < * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else < * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
* := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. 14,31c16,19 < < #include "fdlibm.h" < < #ifdef __STDC__ < static const double < #else < static double < #endif < one = 1.0, < ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ < < #ifdef __STDC__ < double __ieee754_acosh(double x) < #else < double __ieee754_acosh(x) < double x; < #endif < {
private static final class Acosh { private static final double one = 1.0; private static final double ln2 = 6.93147180559945286227e-01; static double compute(double x) { 41c29 < return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
return log(x)+ln2; /* acosh(huge)=log(2x) */
46c34 < return __ieee754_log(2.0*x-one/(x+sqrt(t-one))); ---
return log(2.0*x-one/(x+sqrt(t-one)));
49a38
}
Transliteration vs more idiomatic port: $ diff -w Acosh.translit.java Acosh.fdlibm.java 5,7c5,9 < * Based on < * acosh(x) = log [ x + sqrt(x*x-1) ] < * we have ---
* * * acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -INF < alpha < < INF * and cosh(acosh(x)) = x, 1 <= x < INF. * It can be written as acosh(x) = ln(x + sqrt(x^2 - 1)), 1 <= x < INF. 11a14,15 * * 16,17c20 < private static final class Acosh { < private static final double one = 1.0;
static final class Acosh { 18a22
23c27 < if(hx<0x3ff00000) { /* x < 1 */ ---
if(hx < 0x3ff00000) { // x < 1 */
25,26c29,30 < } else if(hx >=0x41b00000) { /* x > 2**28 */ < if(hx >=0x7ff00000) { /* x is inf of NaN */ ---
} else if (hx >= 0x41b00000) { // x > 2**28 if(hx >= 0x7ff00000) { // x is inf of NaN
28,29c32,34 < } else < return log(x)+ln2; /* acosh(huge)=log(2x) */ ---
} else { return Log.compute(x) + ln2; // acosh(huge) = log(2x) }
31,32c36,37 < return 0.0; /* acosh(1) = 0 */ < } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ ---
return 0.0; // acosh(1) = 0 } else if (hx > 0x40000000) { // 2**28 > x > 2
34,37c39,42 < return log(2.0*x-one/(x+sqrt(t-one))); < } else { /* 1<x<2 */ < t = x-one; < return log1p(t+sqrt(2.0*t+t*t)); ---
return Log.compute(2.0 * x - 1.0 / (x + Sqrt.compute(t - 1.0))); } else { // 1< x <2 t = x - 1.0; return Log1p.compute(t + Sqrt.compute(2.0 * t + t * t));
------------- Commit messages: - 8376665: Fixed whitespaces. - 8376665: Fixed whitespaces. - 8376665: Ported fdlibm acosh function. Added tests. - Merge remote-tracking branch 'origin/master' into JDK-8375285-port-fdlibm-asinh-to-java - 8375285: Added versions. - 8375285: Addressed the reviewer's comments, fixed year in the copyright notice. - 8375285: Addressed the reviewer's comments. - 8375285: Port of fdlibm asinh function Changes: https://git.openjdk.org/jdk/pull/29488/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8376665 Stats: 1163 lines in 7 files changed: 1149 ins; 0 del; 14 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Original C vs transliteration port:
$ diff -w fdlib_acosh.c.txt Acosh.translit.java 1c1,3 < /* __ieee754_acosh(x) ---
/** * Return the Inverse Hyperbolic Cosine of x * 7,8c9,10 < * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else < * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
* := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. 14,31c16,19 < < #include "fdlibm.h" < < #ifdef __STDC__ < static const double < #else < static double < #endif < one = 1.0, < ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ < < #ifdef __STDC__ < double __ieee754_acosh(double x) < #else < double __ieee754_acosh(x) < double x; < #endif < {
private static final class Acosh { private static final double one = 1.0; private static final double ln2 = 6.93147180559945286227e-01; static double compute(double x) { 41c29 < return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
return log(x)+ln2; /* acosh(huge)=log(2x) */
46c34 < return __ieee754_log(2.0*x-one/(x+sqrt(t-one))); ---
return log(2.0*x-one/(x+sqrt(t-one)));
49a38
}
Transliteration vs more idiomatic port:
$ diff -w Acosh.translit.java Acosh.fdlibm.java 5,7c5,9 < * Based on < * acosh(x) = log [ x + sqrt(x*x-1) ] < * we have ---
* * * acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -INF < alpha < < INF * and cosh(acosh(x)) = x, 1 <= x < INF. * It can be written as acosh(x) = ln(x + sqrt(x^2 - 1)), 1 <= x < INF. 11a14,15 * * 16,17c20 < private static final class Acosh { < private static final double one = 1.0;
static final class Acosh { 18a22
23c27 < if(hx<0x3ff00000) { /* x < 1 */ ---
if(hx < 0x3ff00000) { // x < 1 */
25,26c29,30 < } else if(hx >=0x41b00000) { /* x > 2**28 */ < if(hx >=0x7ff00000) { /* x is inf of NaN */ ---
} else if (hx >= 0x41b00000) { // x > 2**28 if(hx >= 0x7ff00000) { // x is inf of NaN
28,29c32,34 < } else < return log(x)+ln2; /* acosh(huge)=log(2x) *...
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision: 8376665: Fixed range, added special test case. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29488/files - new: https://git.openjdk.org/jdk/pull/29488/files/a70da053..44147eb7 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=00-01 Stats: 8 lines in 3 files changed: 5 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Original C vs transliteration port:
$ diff -w fdlib_acosh.c.txt Acosh.translit.java 1c1,3 < /* __ieee754_acosh(x) ---
/** * Return the Inverse Hyperbolic Cosine of x * 7,8c9,10 < * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else < * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
* := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. 14,31c16,19 < < #include "fdlibm.h" < < #ifdef __STDC__ < static const double < #else < static double < #endif < one = 1.0, < ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ < < #ifdef __STDC__ < double __ieee754_acosh(double x) < #else < double __ieee754_acosh(x) < double x; < #endif < {
private static final class Acosh { private static final double one = 1.0; private static final double ln2 = 6.93147180559945286227e-01; static double compute(double x) { 41c29 < return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
return log(x)+ln2; /* acosh(huge)=log(2x) */
46c34 < return __ieee754_log(2.0*x-one/(x+sqrt(t-one))); ---
return log(2.0*x-one/(x+sqrt(t-one)));
49a38
}
Transliteration vs more idiomatic port:
$ diff -w Acosh.translit.java Acosh.fdlibm.java 5,7c5,9 < * Based on < * acosh(x) = log [ x + sqrt(x*x-1) ] < * we have ---
* * * acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -INF < alpha < < INF * and cosh(acosh(x)) = x, 1 <= x < INF. * It can be written as acosh(x) = ln(x + sqrt(x^2 - 1)), 1 <= x < INF. 11a14,15 * * 16,17c20 < private static final class Acosh { < private static final double one = 1.0;
static final class Acosh { 18a22
23c27 < if(hx<0x3ff00000) { /* x < 1 */ ---
if(hx < 0x3ff00000) { // x < 1 */
25,26c29,30 < } else if(hx >=0x41b00000) { /* x > 2**28 */ < if(hx >=0x7ff00000) { /* x is inf of NaN */ ---
} else if (hx >= 0x41b00000) { // x > 2**28 if(hx >= 0x7ff00000) { // x is inf of NaN
28,29c32,34 < } else < return log(x)+ln2; /* acosh(huge)=log(2x) *...
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision: 8376665: Fixed definition of inverse cosh. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29488/files - new: https://git.openjdk.org/jdk/pull/29488/files/44147eb7..fceec2f1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=01-02 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Original C vs transliteration port:
$ diff -w fdlib_acosh.c.txt Acosh.translit.java 1c1,3 < /* __ieee754_acosh(x) ---
/** * Return the Inverse Hyperbolic Cosine of x * 7,8c9,10 < * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else < * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
* := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. 14,31c16,19 < < #include "fdlibm.h" < < #ifdef __STDC__ < static const double < #else < static double < #endif < one = 1.0, < ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ < < #ifdef __STDC__ < double __ieee754_acosh(double x) < #else < double __ieee754_acosh(x) < double x; < #endif < {
private static final class Acosh { private static final double one = 1.0; private static final double ln2 = 6.93147180559945286227e-01; static double compute(double x) { 41c29 < return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
return log(x)+ln2; /* acosh(huge)=log(2x) */
46c34 < return __ieee754_log(2.0*x-one/(x+sqrt(t-one))); ---
return log(2.0*x-one/(x+sqrt(t-one)));
49a38
}
Transliteration vs more idiomatic port:
$ diff -w Acosh.translit.java Acosh.fdlibm.java 5,7c5,9 < * Based on < * acosh(x) = log [ x + sqrt(x*x-1) ] < * we have ---
* * * acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -INF < alpha < < INF * and cosh(acosh(x)) = x, 1 <= x < INF. * It can be written as acosh(x) = ln(x + sqrt(x^2 - 1)), 1 <= x < INF. 11a14,15 * * 16,17c20 < private static final class Acosh { < private static final double one = 1.0;
static final class Acosh { 18a22
23c27 < if(hx<0x3ff00000) { /* x < 1 */ ---
if(hx < 0x3ff00000) { // x < 1 */
25,26c29,30 < } else if(hx >=0x41b00000) { /* x > 2**28 */ < if(hx >=0x7ff00000) { /* x is inf of NaN */ ---
} else if (hx >= 0x41b00000) { // x > 2**28 if(hx >= 0x7ff00000) { // x is inf of NaN
28,29c32,34 < } else < return log(x)+ln2; /* acosh(huge)=log(2x) *...
Anton Artemov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits: - 8376665: Resolved merge conflicts. - 8376665: Fixed definition of inverse cosh. - 8376665: Fixed range, added special test case. - 8376665: Fixed whitespaces. - 8376665: Fixed whitespaces. - 8376665: Ported fdlibm acosh function. Added tests. - Merge remote-tracking branch 'origin/master' into JDK-8375285-port-fdlibm-asinh-to-java - 8375285: Added versions. - 8375285: Addressed the reviewer's comments, fixed year in the copyright notice. - 8375285: Addressed the reviewer's comments. - ... and 1 more: https://git.openjdk.org/jdk/compare/56afb460...32e51c37 ------------- Changes: https://git.openjdk.org/jdk/pull/29488/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=03 Stats: 582 lines in 7 files changed: 573 ins; 0 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
On Wed, 11 Feb 2026 09:26:25 GMT, Anton Artemov <aartemov@openjdk.org> wrote:
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Original C vs transliteration port:
$ diff -w fdlib_acosh.c.txt Acosh.translit.java 1c1,3 < /* __ieee754_acosh(x) ---
/** * Return the Inverse Hyperbolic Cosine of x * 7,8c9,10 < * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else < * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
* := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. 14,31c16,19 < < #include "fdlibm.h" < < #ifdef __STDC__ < static const double < #else < static double < #endif < one = 1.0, < ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ < < #ifdef __STDC__ < double __ieee754_acosh(double x) < #else < double __ieee754_acosh(x) < double x; < #endif < {
private static final class Acosh { private static final double one = 1.0; private static final double ln2 = 6.93147180559945286227e-01; static double compute(double x) { 41c29 < return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
return log(x)+ln2; /* acosh(huge)=log(2x) */
46c34 < return __ieee754_log(2.0*x-one/(x+sqrt(t-one))); ---
return log(2.0*x-one/(x+sqrt(t-one)));
49a38
}
Transliteration vs more idiomatic port:
$ diff -w Acosh.translit.java Acosh.fdlibm.java 5,7c5,9 < * Based on < * acosh(x) = log [ x + sqrt(x*x-1) ] < * we have ---
* * * acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -INF < alpha < < INF * and cosh(acosh(x)) = x, 1 <= x < INF. * It can be written as acosh(x) = ln(x + sqrt(x^2 - 1)), 1 <= x < INF. 11a14,15 * * 16,17c20 < private static final class Acosh { < private static final double one = 1.0;
static final class Acosh { 18a22
23c27 < if(hx<0x3ff00000) { /* x < 1 */ ---
if(hx < 0x3ff00000) { // x < 1 */
25,26c29,30 < } else if(hx >=0x41b00000) { /* x > 2**28 */ < if(hx >=0x7ff00000) { /* x is inf of NaN */ ---
} else if (hx >= 0x41b00000) { // x > 2**28 if(hx >= 0x7ff00000) { ...
Anton Artemov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits:
- 8376665: Resolved merge conflicts. - 8376665: Fixed definition of inverse cosh. - 8376665: Fixed range, added special test case. - 8376665: Fixed whitespaces. - 8376665: Fixed whitespaces. - 8376665: Ported fdlibm acosh function. Added tests. - Merge remote-tracking branch 'origin/master' into JDK-8375285-port-fdlibm-asinh-to-java - 8375285: Added versions. - 8375285: Addressed the reviewer's comments, fixed year in the copyright notice. - 8375285: Addressed the reviewer's comments. - ... and 1 more: https://git.openjdk.org/jdk/compare/56afb460...32e51c37
Original C vs transliteration port: $ diff -w fdlib_acosh.c.txt Acosh.translit.java 1c1,3 < /* __ieee754_acosh(x) ---
/** * Return the Inverse Hyperbolic Cosine of x * 7,8c9,10 < * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else < * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
* := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. 14,31c16,19 < < #include "fdlibm.h" < < #ifdef __STDC__ < static const double < #else < static double < #endif < one = 1.0, < ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ < < #ifdef __STDC__ < double __ieee754_acosh(double x) < #else < double __ieee754_acosh(x) < double x; < #endif < {
private static final class Acosh { private static final double one = 1.0; private static final double ln2 = 6.93147180559945286227e-01; static double compute(double x) { 41c29 < return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */
return log(x)+ln2; /* acosh(huge)=log(2x) */
46c34 < return __ieee754_log(2.0*x-one/(x+sqrt(t-one))); ---
return log(2.0*x-one/(x+sqrt(t-one)));
49a38
}
Transliteration vs more idiomatic port: $ diff -w Acosh.translit.java Acosh.fdlibm.java 5,7c5,9 < * Based on < * acosh(x) = log [ x + sqrt(x*x-1) ] < * we have ---
* * * acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -INF < alpha < < INF * and cosh(acosh(x)) = x, 1 <= x < INF. * It can be written as acosh(x) = ln(x + sqrt(x^2 - 1)), 1 <= x < INF. 11a14,15 * * 16,17c20 < private static final class Acosh { < private static final double one = 1.0;
static final class Acosh { 18a22
23c27 < if(hx<0x3ff00000) { /* x < 1 */ ---
if(hx < 0x3ff00000) { // x < 1 */
25,26c29,30 < } else if(hx >=0x41b00000) { /* x > 2**28 */ < if(hx >=0x7ff00000) { /* x is inf of NaN */ ---
} else if (hx >= 0x41b00000) { // x > 2**28 if(hx >= 0x7ff00000) { // x is inf of NaN
28,29c32,34 < } else < return log(x)+ln2; /* acosh(huge)=log(2x) */ ---
} else { return Log.compute(x) + ln2; // acosh(huge) = log(2x) }
31,32c36,37 < return 0.0; /* acosh(1) = 0 */ < } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ ---
return 0.0; // acosh(1) = 0 } else if (hx > 0x40000000) { // 2**28 > x > 2
34,37c39,42 < return log(2.0*x-one/(x+sqrt(t-one))); < } else { /* 1<x<2 */ < t = x-one; < return log1p(t+sqrt(2.0*t+t*t)); ---
return Log.compute(2.0 * x - 1.0 / (x + Sqrt.compute(t - 1.0))); } else { // 1< x <2 t = x - 1.0; return Log1p.compute(t + Sqrt.compute(2.0 * t + t * t));
------------- PR Comment: https://git.openjdk.org/jdk/pull/29488#issuecomment-3883252611
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision: 8376665: Fixed whitespaces. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29488/files - new: https://git.openjdk.org/jdk/pull/29488/files/32e51c37..702c955f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=03-04 Stats: 38 lines in 2 files changed: 1 ins; 0 del; 37 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision: 8376665: Fixed accidentally repeated testcase. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29488/files - new: https://git.openjdk.org/jdk/pull/29488/files/702c955f..dd5c5f7e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=04-05 Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with two additional commits since the last revision: - 8376665: Stylistical fixes. - 8376665: Stylistical fixes. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29488/files - new: https://git.openjdk.org/jdk/pull/29488/files/dd5c5f7e..9e468d66 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=05-06 Stats: 31 lines in 5 files changed: 0 ins; 2 del; 29 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
On Wed, 11 Feb 2026 11:04:02 GMT, Anton Artemov <aartemov@openjdk.org> wrote:
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with two additional commits since the last revision:
- 8376665: Stylistical fixes. - 8376665: Stylistical fixes.
Otherwise looks fine. 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 `<` 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. 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. 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. ------------- PR Review: https://git.openjdk.org/jdk/pull/29488#pullrequestreview-3785030643 PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2793485148 PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2793485365 PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2793485903 PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2793486254
On Wed, 11 Feb 2026 14:05:34 GMT, Raffaello Giulietti <rgiulietti@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
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision: 8376665: Addressed reviewer's comments. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29488/files - new: https://git.openjdk.org/jdk/pull/29488/files/9e468d66..e50c546a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=06-07 Stats: 6 lines in 3 files changed: 0 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
On Thu, 12 Feb 2026 08:45:14 GMT, Anton Artemov <aartemov@openjdk.org> wrote:
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
8376665: Addressed reviewer's comments.
src/java.base/share/classes/java/lang/FdLibm.java line 3591:
3589: int hx; 3590: hx = __HI(x); 3591: if(hx < 0x3ff0_0000) { // x < 1 */
Suggestion: if (hx < 0x3ff0_0000) { // x < 1 */ src/java.base/share/classes/java/lang/FdLibm.java line 3594:
3592: return (x - x) / (x - x); 3593: } else if (hx >= 0x41b0_0000) { // x > 2**28 3594: if(hx >= 0x7ff0_0000) { // x is inf of NaN
Suggestion: if (hx >= 0x7ff0_0000) { // x is inf of NaN ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2798021724 PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2798022331
On Thu, 12 Feb 2026 10:25:32 GMT, Andrey Turbanov <aturbanov@openjdk.org> wrote:
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
8376665: Addressed reviewer's comments.
src/java.base/share/classes/java/lang/FdLibm.java line 3591:
3589: int hx; 3590: hx = __HI(x); 3591: if(hx < 0x3ff0_0000) { // x < 1 */
Suggestion:
if (hx < 0x3ff0_0000) { // x < 1 */
Fixed.
src/java.base/share/classes/java/lang/FdLibm.java line 3594:
3592: return (x - x) / (x - x); 3593: } else if (hx >= 0x41b0_0000) { // x > 2**28 3594: if(hx >= 0x7ff0_0000) { // x is inf of NaN
Suggestion:
if (hx >= 0x7ff0_0000) { // x is inf of NaN
Fixed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2798480203 PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2798480381
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision: 8376665: Fixed whitespaces. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/29488/files - new: https://git.openjdk.org/jdk/pull/29488/files/e50c546a..13218df6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29488&range=07-08 Stats: 7 lines in 1 file changed: 0 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/29488.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/29488/head:pull/29488 PR: https://git.openjdk.org/jdk/pull/29488
On Thu, 12 Feb 2026 12:04:41 GMT, Anton Artemov <aartemov@openjdk.org> wrote:
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
8376665: Fixed whitespaces.
Please wait 24 hours before integrating to give a chance for everyone in all timezones to chime in. ------------- Marked as reviewed by rgiulietti (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29488#pullrequestreview-3791425190
On Thu, 12 Feb 2026 12:04:41 GMT, Anton Artemov <aartemov@openjdk.org> wrote:
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
8376665: Fixed whitespaces.
Marked as reviewed by darcy (Reviewer). src/java.base/share/classes/java/lang/FdLibm.java line 3585:
3583: */ 3584: static final class Acosh { 3585: private static final double ln2 = 6.93147180559945286227e-01;
Note for a possible future refactoring: many of the double constants elsewhere use hexadecimal literals rather than decimal ones. ------------- PR Review: https://git.openjdk.org/jdk/pull/29488#pullrequestreview-3798732430 PR Review Comment: https://git.openjdk.org/jdk/pull/29488#discussion_r2805462996
On Thu, 12 Feb 2026 12:04:41 GMT, Anton Artemov <aartemov@openjdk.org> wrote:
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
8376665: Fixed whitespaces.
Thanks for reviews! ------------- PR Comment: https://git.openjdk.org/jdk/pull/29488#issuecomment-3907086316
On Thu, 29 Jan 2026 14:56:49 GMT, Anton Artemov <aartemov@openjdk.org> wrote:
Hi, please consider the following changes:
This is a port of FDLIBM acosh method.
This pull request has now been integrated. Changeset: b9406a5d Author: Anton Artemov <aartemov@openjdk.org> URL: https://git.openjdk.org/jdk/commit/b9406a5dbaac7082419ea936f3cc3e61e6ac96d0 Stats: 580 lines in 7 files changed: 571 ins; 0 del; 9 mod 8376665: Port fdlibm acosh to Java Reviewed-by: rgiulietti, darcy ------------- PR: https://git.openjdk.org/jdk/pull/29488
participants (4)
-
Andrey Turbanov
-
Anton Artemov
-
Joe Darcy
-
Raffaello Giulietti