[COMMITTED] math: Update tanh from CORE-MATH (revision dbd377a9)

Adhemerval Zanella adhemerval.zanella@linaro.org
Mon Sep 14 13:39:56 GMT 2026


Update the fast path error bound for |x| < 0x1p-2 from 0x1.ap-52 to
0x1.c0p-52 to match the proof (line 11 of Algorithm 1 in
https://core-math.gitlabpages.inria.fr/tanh.pdf).

Checked on aarch64-linux-gnu.
---
 SHARED-FILES                    | 2 +-
 sysdeps/ieee754/dbl-64/s_tanh.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/SHARED-FILES b/SHARED-FILES
index f17a76dbf7..30edf8cebc 100644
--- a/SHARED-FILES
+++ b/SHARED-FILES
@@ -281,7 +281,7 @@ core-math:
   sysdeps/ieee754/dbl-64/s_erf.c
   # src/binary64/erfc/erfc.c, revision 55e9869e
   sysdeps/ieee754/dbl-64/s_erfc.c
-  # src/binary64/tanh/tanh.c, revision bb39e4fa
+  # src/binary64/tanh/tanh.c, revision dbd377a9
   sysdeps/ieee754/dbl-64/s_tanh.c
   # src/binary32/acos/acosf.c, revision 56dd347
   sysdeps/ieee754/flt-32/e_acosf.c
diff --git a/sysdeps/ieee754/dbl-64/s_tanh.c b/sysdeps/ieee754/dbl-64/s_tanh.c
index 6d57cef5b8..2beffdf52a 100644
--- a/sysdeps/ieee754/dbl-64/s_tanh.c
+++ b/sysdeps/ieee754/dbl-64/s_tanh.c
@@ -207,7 +207,7 @@ __tanh (double x)
 	     [0x1.015891c9eaef8p-3, 0x1.019891c9eaef8p-3] was checked
 	     exhaustively with rndz and without fma contraction, with error
 	     bound e = x3*0x1.80p-52: no failure.  */
-	  double e = x3 * 0x1.ap-52, lb = rh + (rl - e), ub = rh + (rl + e);
+	  double e = x3 * 0x1.c0p-52, lb = rh + (rl - e), ub = rh + (rl + e);
 	  if (lb == ub)
 	    return lb;
 	  return as_tanh_zero (x);
-- 
2.47.3



More information about the Libc-alpha mailing list