]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
math: Consolidated common definition/data for cosh/sinh/tanh
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 12 Mar 2026 14:21:10 +0000 (11:21 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 16 Mar 2026 16:52:20 +0000 (13:52 -0300)
Common data definitions are moved to e_coshsinh_data, cosh only
data is moved to e_cosh_data, sinh to e_sinh_data, and tanh to
e_tanh_data.

Reviewed-by: DJ Delorie <dj@redhat.com>
12 files changed:
math/Makefile
sysdeps/ieee754/dbl-64/e_cosh.c
sysdeps/ieee754/dbl-64/e_cosh_data.c [new file with mode: 0644]
sysdeps/ieee754/dbl-64/e_cosh_data.h [new file with mode: 0644]
sysdeps/ieee754/dbl-64/e_coshsinh_data.c [new file with mode: 0644]
sysdeps/ieee754/dbl-64/e_coshsinh_data.h [new file with mode: 0644]
sysdeps/ieee754/dbl-64/e_sinh.c
sysdeps/ieee754/dbl-64/e_sinh_data.c [new file with mode: 0644]
sysdeps/ieee754/dbl-64/e_sinh_data.h [new file with mode: 0644]
sysdeps/ieee754/dbl-64/e_tanh_data.c [new file with mode: 0644]
sysdeps/ieee754/dbl-64/e_tanh_data.h [new file with mode: 0644]
sysdeps/ieee754/dbl-64/s_tanh.c

index b546626f157114e3f838bdc2b27d2f4eaa8efe67..2eb0085de91314c170c3c00bae84ccf7606ee3c1 100644 (file)
@@ -359,10 +359,14 @@ type-ldouble-yes := ldouble
 type-double-suffix :=
 type-double-routines := \
   branred \
+  e_cosh_data \
+  e_coshsinh_data \
   e_exp_data \
   e_log2_data \
   e_log_data \
   e_pow_log_data \
+  e_sinh_data \
+  e_tanh_data \
   k_rem_pio2 \
   math_err \
   s_asincosh_data \
index d7cc7ff937ab0f20a3ff799e77f288c145119d4b..f9008e6e5f5e3a4c82767611c90f1fe3bbb867a9 100644 (file)
@@ -24,11 +24,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
+#include <array_length.h>
 #include <math.h>
 #include <libm-alias-finite.h>
 #include <libm-alias-double.h>
 #include <math-svid-compat.h>
 #include <ddcoremath.h>
+#include "e_cosh_data.h"
+#include "e_coshsinh_data.h"
 #include "math_config.h"
 
 static __attribute__ ((noinline)) double as_cosh_database (double, double);
@@ -80,23 +83,9 @@ as_exp_accurate (double x, double t, double th, double tl, double *l)
 static double __attribute__ ((noinline))
 as_cosh_zero (double x)
 {
-  static const double ch[][2] =
-    {
-      { 0x1p-1, -0x1.c7e8db669f624p-111 },                // degree 2
-      { 0x1.5555555555555p-5, 0x1.5555555556135p-59 },    // degree 4
-      { 0x1.6c16c16c16c17p-10, -0x1.f49f4a6e838f2p-65 },  // degree 6
-      { 0x1.a01a01a01a01ap-16, 0x1.a4ffbe15316aap-76 }    // degree 8
-    };
-  static const double cl[] =
-    {
-      0x1.27e4fb7789f5cp-22,                              // degree 10
-      0x1.1eed8eff9089cp-29,                              // degree 12
-      0x1.939749ce13dadp-37,                              // degree 14
-      0x1.ae9891efb6691p-45                               // degree 16
-    };
   double x2 = x * x, x2l = fma (x, x, -x2);
-  double y2 = x2 * (cl[0] + x2 * (cl[1] + x2 * (cl[2] + x2 * cl[3])));
-  double y1 = polydd (x2, x2l, 4, ch, &y2);
+  double y2 = x2 * (CL[0] + x2 * (CL[1] + x2 * (CL[2] + x2 * (CL[3]))));
+  double y1 = polydd (x2, x2l, 4, CH, &y2);
   y1 = muldd2 (y1, y2, x2, x2l, &y2);
   double y0 = fasttwosum (1.0, y1, &y1);
   y1 = fasttwosum (y1, y2, &y2);
@@ -118,39 +107,15 @@ as_cosh_zero (double x)
 static __attribute__ ((noinline)) double
 as_cosh_database (double x, double f)
 {
-  static const double db[][3] =
-    {
-      { 0x1.9a5e3cbe1985ep-4, 0x1.01492f72f984bp+0, -0x1p-107 },
-      { 0x1.52a11832e847dp-3, 0x1.0381e68cac923p+0, 0x1p-104 },
-      { 0x1.bf0305e2c6c37p-3, 0x1.061f4c39e16f2p+0, 0x1p-107 },
-      { 0x1.17326ffc09f68p-2, 0x1.099318a43ac8p+0, 0x1p-104 },
-      { 0x1.3d27bf16d8bdbp-2, 0x1.0c6091056e06ap+0, -0x1p-107 },
-      { 0x1.03923f2b47c07p-1, 0x1.219c1989e3373p+0, -0x1p-54 },
-      { 0x1.a6031cd5f93bap-1, 0x1.5bff041b260fep+0, -0x1p-107 },
-      { 0x1.104b648f113a1p+0, 0x1.9efdca62b700ap+0, -0x1p-109 },
-      { 0x1.1585720f35cd9p+0, 0x1.a5bf3acfde4b2p+0, 0x1p-105 },
-      { 0x1.e9cc7ed2e1a7ep+0, 0x1.bb0ff220d8eb5p+1, -0x1p-53 },
-      { 0x1.43180ea854696p+1, 0x1.91f1122b6b63ap+2, 0x1p-102 },
-      { 0x1.725811dcf6782p+2, 0x1.45ea160ddc71fp+7, -0x1p-100 },
-      { 0x1.5afd56f7d565bp+3, 0x1.8ff8e0ccea7cp+14, 0x1p-90 },
-      { 0x1.759a2ad4c4d56p+3, 0x1.cb62eec26bd78p+15, -0x1p-92 },
-      { 0x1.7fce95ea5c653p+3, 0x1.3bf8009648dcp+16, 0x1p-88 },
-      { 0x1.743d5609348acp+4, 0x1.7a87a8bb7fa28p+32, -0x1p-22 },
-      { 0x1.e07e71bfcf06fp+5, 0x1.91ec4412c344fp+85, 0x1p-24 },
-      { 0x1.6474c604cc0d7p+6, 0x1.7a8f65ad009bdp+127, -0x1p+20 },
-      { 0x1.54cd1fea7663ap+7, 0x1.c90810d354618p+244, 0x1p+135 },
-      { 0x1.2da9e5e6af0bp+8, 0x1.27d6fe867d6f6p+434, 0x1p+329 },
-      { 0x1.d6479eba7c971p+8, 0x1.62a88613629b6p+677, -0x1p+568 },
-  };
-  int a = 0, b = sizeof (db) / sizeof (db[0]) - 1, m = (a + b) / 2;
+  int a = 0, b = array_length (DB) - 1, m = (a + b) / 2;
   double ax = fabs (x);
   while (a <= b)
     {
-      if (db[m][0] < ax)
+      if (DB[m][0] < ax)
        a = m + 1;
-      else if (db[m][0] == ax)
+      else if (DB[m][0] == ax)
        {
-         f = db[m][1] + db[m][2];
+         f = DB[m][1] + DB[m][2];
          break;
        }
       else
@@ -163,151 +128,6 @@ as_cosh_database (double x, double f)
 double
 __cosh (double x)
 {
-  /*
-    The function cosh(x) is approximated by a minimax polynomial
-    cosh(x)~1+x^2*P(x^2) for |x|<0.125. For other arguments the
-    identity cosh(x)=(exp(|x|)+exp(-|x|))/2 is used. For |x|<5 both
-    exponents are calculated with slightly higher precision than
-    double. For 5<|x|<36.736801 the exp(-|x|) is rather small and is
-    calculated with double precision but exp(|x|) is calculated with
-    higher than double precision. For 36.736801<|x|<710.47586
-    exp(-|x|) becomes too small and only exp(|x|) is calculated.
-   */
-  static const double t0[][2] =
-    {
-      { 0x0p+0, 0x1p+0 },
-      { -0x1.19083535b085ep-56, 0x1.02c9a3e778061p+0 },
-      { 0x1.d73e2a475b466p-55, 0x1.059b0d3158574p+0 },
-      { 0x1.186be4bb285p-57, 0x1.0874518759bc8p+0 },
-      { 0x1.8a62e4adc610ap-54, 0x1.0b5586cf9890fp+0 },
-      { 0x1.03a1727c57b52p-59, 0x1.0e3ec32d3d1a2p+0 },
-      { -0x1.6c51039449b3ap-54, 0x1.11301d0125b51p+0 },
-      { -0x1.32fbf9af1369ep-54, 0x1.1429aaea92dep+0 },
-      { -0x1.19041b9d78a76p-55, 0x1.172b83c7d517bp+0 },
-      { 0x1.e5b4c7b4968e4p-55, 0x1.1a35beb6fcb75p+0 },
-      { 0x1.e016e00a2643cp-54, 0x1.1d4873168b9aap+0 },
-      { 0x1.dc775814a8494p-55, 0x1.2063b88628cd6p+0 },
-      { 0x1.9b07eb6c70572p-54, 0x1.2387a6e756238p+0 },
-      { 0x1.2bd339940e9dap-55, 0x1.26b4565e27cddp+0 },
-      { 0x1.612e8afad1256p-55, 0x1.29e9df51fdee1p+0 },
-      { 0x1.0024754db41d4p-54, 0x1.2d285a6e4030bp+0 },
-      { 0x1.6f46ad23182e4p-55, 0x1.306fe0a31b715p+0 },
-      { 0x1.32721843659a6p-54, 0x1.33c08b26416ffp+0 },
-      { -0x1.63aeabf42eae2p-54, 0x1.371a7373aa9cbp+0 },
-      { -0x1.5e436d661f5e2p-56, 0x1.3a7db34e59ff7p+0 },
-      { 0x1.ada0911f09ebcp-55, 0x1.3dea64c123422p+0 },
-      { -0x1.ef3691c309278p-58, 0x1.4160a21f72e2ap+0 },
-      { 0x1.89b7a04ef80dp-59, 0x1.44e086061892dp+0 },
-      { 0x1.3c1a3b69062fp-56, 0x1.486a2b5c13cdp+0 },
-      { 0x1.d4397afec42e2p-56, 0x1.4bfdad5362a27p+0 },
-      { -0x1.4b309d25957e4p-54, 0x1.4f9b2769d2ca7p+0 },
-      { -0x1.07abe1db13cacp-55, 0x1.5342b569d4f82p+0 },
-      { 0x1.9bb2c011d93acp-54, 0x1.56f4736b527dap+0 },
-      { 0x1.6324c054647acp-54, 0x1.5ab07dd485429p+0 },
-      { 0x1.ba6f93080e65ep-54, 0x1.5e76f15ad2148p+0 },
-      { -0x1.383c17e40b496p-54, 0x1.6247eb03a5585p+0 },
-      { -0x1.bb60987591c34p-54, 0x1.6623882552225p+0 },
-      { -0x1.bdd3413b26456p-54, 0x1.6a09e667f3bcdp+0 },
-      { -0x1.bbe3a683c88aap-57, 0x1.6dfb23c651a2fp+0 },
-      { -0x1.16e4786887a9ap-55, 0x1.71f75e8ec5f74p+0 },
-      { -0x1.0245957316dd4p-54, 0x1.75feb564267c9p+0 },
-      { -0x1.41577ee04993p-55, 0x1.7a11473eb0187p+0 },
-      { 0x1.05d02ba15797ep-56, 0x1.7e2f336cf4e62p+0 },
-      { -0x1.d4c1dd41532d8p-54, 0x1.82589994cce13p+0 },
-      { -0x1.fc6f89bd4f6bap-54, 0x1.868d99b4492edp+0 },
-      { 0x1.6e9f156864b26p-54, 0x1.8ace5422aa0dbp+0 },
-      { 0x1.5cc13a2e3976cp-55, 0x1.8f1ae99157736p+0 },
-      { -0x1.75fc781b57ebcp-57, 0x1.93737b0cdc5e5p+0 },
-      { -0x1.d185b7c1b85dp-54, 0x1.97d829fde4e5p+0 },
-      { 0x1.c7c46b071f2bep-56, 0x1.9c49182a3f09p+0 },
-      { -0x1.359495d1cd532p-54, 0x1.a0c667b5de565p+0 },
-      { -0x1.d2f6edb8d41e2p-54, 0x1.a5503b23e255dp+0 },
-      { 0x1.0fac90ef7fd32p-54, 0x1.a9e6b5579fdbfp+0 },
-      { 0x1.7a1cd345dcc82p-54, 0x1.ae89f995ad3adp+0 },
-      { -0x1.2805e3084d708p-57, 0x1.b33a2b84f15fbp+0 },
-      { -0x1.5584f7e54ac3ap-56, 0x1.b7f76f2fb5e47p+0 },
-      { 0x1.23dd07a2d9e84p-55, 0x1.bcc1e904bc1d2p+0 },
-      { 0x1.11065895048dep-55, 0x1.c199bdd85529cp+0 },
-      { 0x1.2884dff483cacp-54, 0x1.c67f12e57d14bp+0 },
-      { 0x1.503cbd1e949dcp-56, 0x1.cb720dcef9069p+0 },
-      { -0x1.cbc3743797a9cp-54, 0x1.d072d4a07897cp+0 },
-      { 0x1.2ed02d75b3706p-55, 0x1.d5818dcfba487p+0 },
-      { 0x1.c2300696db532p-54, 0x1.da9e603db3285p+0 },
-      { -0x1.1a5cd4f184b5cp-54, 0x1.dfc97337b9b5fp+0 },
-      { 0x1.39e8980a9cc9p-55, 0x1.e502ee78b3ff6p+0 },
-      { -0x1.e9c23179c2894p-54, 0x1.ea4afa2a490dap+0 },
-      { 0x1.dc7f486a4b6bp-54, 0x1.efa1bee615a27p+0 },
-      { 0x1.9d3e12dd8a18ap-54, 0x1.f50765b6e454p+0 },
-      { 0x1.74853f3a5931ep-55, 0x1.fa7c1819e90d8p+0 }
-    };
-  static const double t1[][2] =
-    {
-      { 0x0p+0, 0x1p+0 },
-      { 0x1.ae8e38c59c72ap-54, 0x1.000b175effdc7p+0 },
-      { -0x1.7b5d0d58ea8f4p-58, 0x1.00162f3904052p+0 },
-      { 0x1.4115cb6b16a8ep-54, 0x1.0021478e11ce6p+0 },
-      { -0x1.d7c96f201bb2ep-55, 0x1.002c605e2e8cfp+0 },
-      { 0x1.84711d4c35eap-54, 0x1.003779a95f959p+0 },
-      { -0x1.0484245243778p-55, 0x1.0042936faa3d8p+0 },
-      { -0x1.4b237da2025fap-54, 0x1.004dadb113dap+0 },
-      { -0x1.5e00e62d6b30ep-56, 0x1.0058c86da1c0ap+0 },
-      { 0x1.a1d6cedbb948p-54, 0x1.0063e3a559473p+0 },
-      { -0x1.4acf197a00142p-54, 0x1.006eff583fc3dp+0 },
-      { -0x1.eaf2ea42391a6p-57, 0x1.007a1b865a8cap+0 },
-      { 0x1.da93f90835f76p-56, 0x1.0085382faef83p+0 },
-      { -0x1.6a79084ab093cp-55, 0x1.00905554425d4p+0 },
-      { 0x1.86364f8fbe8f8p-54, 0x1.009b72f41a12bp+0 },
-      { -0x1.82e8e14e3110ep-55, 0x1.00a6910f3b6fdp+0 },
-      { -0x1.4f6b2a7609f72p-55, 0x1.00b1afa5abcbfp+0 },
-      { -0x1.e1a258ea8f71ap-56, 0x1.00bcceb7707ecp+0 },
-      { 0x1.4362ca5bc26f2p-56, 0x1.00c7ee448ee02p+0 },
-      { 0x1.095a56c919d02p-54, 0x1.00d30e4d0c483p+0 },
-      { -0x1.406ac4e81a646p-57, 0x1.00de2ed0ee0f5p+0 },
-      { 0x1.b5a6902767e08p-54, 0x1.00e94fd0398ep+0 },
-      { -0x1.91b206085932p-54, 0x1.00f4714af41d3p+0 },
-      { 0x1.427068ab22306p-55, 0x1.00ff93412315cp+0 },
-      { 0x1.c1d0660524e08p-54, 0x1.010ab5b2cbd11p+0 },
-      { -0x1.e7bdfb3204be8p-54, 0x1.0115d89ff3a8bp+0 },
-      { 0x1.843aa8b9cbbc6p-55, 0x1.0120fc089ff63p+0 },
-      { -0x1.34104ee7edae8p-56, 0x1.012c1fecd613bp+0 },
-      { -0x1.2b6aeb6176892p-56, 0x1.0137444c9b5b5p+0 },
-      { 0x1.a8cd33b8a1bb2p-56, 0x1.01426927f5278p+0 },
-      { 0x1.2edc08e5da99ap-56, 0x1.014d8e7ee8d2fp+0 },
-      { 0x1.57ba2dc7e0c72p-55, 0x1.0158b4517bb88p+0 },
-      { 0x1.b61299ab8cdb8p-54, 0x1.0163da9fb3335p+0 },
-      { -0x1.90565902c5f44p-54, 0x1.016f0169949edp+0 },
-      { 0x1.70fc41c5c2d54p-55, 0x1.017a28af25567p+0 },
-      { 0x1.4b9a6e145d76cp-54, 0x1.018550706ab62p+0 },
-      { -0x1.008eff5142bfap-56, 0x1.019078ad6a19fp+0 },
-      { -0x1.77669f033c7dep-54, 0x1.019ba16628de2p+0 },
-      { -0x1.09bb78eeead0ap-54, 0x1.01a6ca9aac5f3p+0 },
-      { 0x1.371231477ece6p-54, 0x1.01b1f44af9f9ep+0 },
-      { 0x1.5e7626621eb5ap-56, 0x1.01bd1e77170b4p+0 },
-      { -0x1.bc72b100828a4p-54, 0x1.01c8491f08f08p+0 },
-      { -0x1.ce39cbbab8bbep-57, 0x1.01d37442d507p+0 },
-      { 0x1.16996709da2e2p-55, 0x1.01de9fe280ac8p+0 },
-      { -0x1.c11f5239bf536p-55, 0x1.01e9cbfe113efp+0 },
-      { 0x1.e1d4eb5edc6b4p-55, 0x1.01f4f8958c1c6p+0 },
-      { -0x1.afb99946ee3fp-54, 0x1.020025a8f6a35p+0 },
-      { -0x1.8f06d8a148a32p-54, 0x1.020b533856324p+0 },
-      { -0x1.2bf310fc54eb6p-55, 0x1.02168143b0281p+0 },
-      { -0x1.c95a035eb4176p-54, 0x1.0221afcb09e3ep+0 },
-      { -0x1.491793e46834cp-54, 0x1.022cdece68c4fp+0 },
-      { -0x1.3e8d0d9c4909p-56, 0x1.02380e4dd22adp+0 },
-      { -0x1.314aa16278aa4p-54, 0x1.02433e494b755p+0 },
-      { 0x1.48daf888e965p-55, 0x1.024e6ec0da046p+0 },
-      { 0x1.56dc8046821f4p-55, 0x1.02599fb483385p+0 },
-      { 0x1.45b42356b9d46p-54, 0x1.0264d1244c719p+0 },
-      { -0x1.082ef51b61d7ep-56, 0x1.027003103b10ep+0 },
-      { 0x1.2106ed0920a34p-56, 0x1.027b357854772p+0 },
-      { -0x1.fd4cf26ea5d0ep-54, 0x1.0286685c9e059p+0 },
-      { -0x1.09f8775e78084p-54, 0x1.02919bbd1d1d8p+0 },
-      { 0x1.64cbba902ca28p-58, 0x1.029ccf99d720ap+0 },
-      { 0x1.4383ef231d206p-54, 0x1.02a803f2d170dp+0 },
-      { 0x1.4a47a505b3a46p-54, 0x1.02b338c811703p+0 },
-      { 0x1.e47120223468p-54, 0x1.02be6e199c811p+0 },
-    };
-
   const double s = 0x1.71547652b82fep+12;
   double ax = fabs (x), v0 = fma (ax, s, 0x1.8000002p+26);
   uint64_t jt = asuint64 (v0);
@@ -368,8 +188,8 @@ __cosh (double x)
   int64_t j1 = jl & 0x3f, j0 = (jl >> 6) & 0x3f, je = jl >> 12;
   double sp = asdouble ((uint64_t) (1022 + ie) << 52),
         sm = asdouble ((uint64_t) (1022 + je) << 52);
-  double t0h = t0[i0][1], t0l = t0[i0][0];
-  double t1h = t1[i1][1], t1l = t1[i1][0];
+  double t0h = T0[i0][1], t0l = T0[i0][0];
+  double t1h = T1[i1][1], t1l = T1[i1][0];
   double th = t0h * t1h, tl = t0h * t1l + t1h * t0l + fma (t0h, t1h, -th);
   const double l2h = 0x1.62e42ffp-13, l2l = 0x1.718432a1b0e26p-47;
   double dx = (ax - l2h * t) + l2l * t, dx2 = dx * dx, mx = -dx;
@@ -405,7 +225,7 @@ __cosh (double x)
            return as_cosh_database (x, th);
          return th;
        }
-      double q0h = t0[j0][1], q1h = t1[j1][1], qh = q0h * q1h;
+      double q0h = T0[j0][1], q1h = T1[j1][1], qh = q0h * q1h;
       th *= sp;
       tl *= sp;
       qh *= sm;
@@ -429,7 +249,7 @@ __cosh (double x)
       else
        {
          qh = q0h * q1h;
-         double q0l = t0[j0][0], q1l = t1[j1][0];
+         double q0l = T0[j0][0], q1l = T1[j1][0];
          double ql = q0h * q1l + q1h * q0l + fma (q0h, q1h, -qh);
          qh *= sm;
          ql *= sm;
@@ -440,8 +260,8 @@ __cosh (double x)
     }
   else
     { // |x| <= 5
-      double q0h = t0[j0][1], q0l = t0[j0][0];
-      double q1h = t1[j1][1], q1l = t1[j1][0];
+      double q0h = T0[j0][1], q0l = T0[j0][0];
+      double q1h = T1[j1][1], q1l = T1[j1][0];
       double qh = q0h * q1h, ql = q0h * q1l + q1h * q0l + fma (q0h, q1h, -qh);
       th *= sp;
       tl *= sp;
diff --git a/sysdeps/ieee754/dbl-64/e_cosh_data.c b/sysdeps/ieee754/dbl-64/e_cosh_data.c
new file mode 100644 (file)
index 0000000..16f505a
--- /dev/null
@@ -0,0 +1,65 @@
+/* Data definitions used by cosh implementation.
+
+Copyright (c) 2023-2026 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+(https://core-math.gitlabpages.inria.fr/).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#include "e_cosh_data.h"
+
+const double __cosh_data_ch[][2] =
+  {
+    { 0x1p-1, -0x1.c7e8db669f624p-111 },
+    { 0x1.5555555555555p-5, 0x1.5555555556135p-59 },
+    { 0x1.6c16c16c16c17p-10, -0x1.f49f4a6e838f2p-65 },
+    { 0x1.a01a01a01a01ap-16, 0x1.a4ffbe15316aap-76 }
+  };
+const double __cosh_data_cl[] =
+  {
+    0x1.27e4fb7789f5cp-22, 0x1.1eed8eff9089cp-29, 0x1.939749ce13dadp-37,
+    0x1.ae9891efb6691p-45
+  };
+
+const double __cosh_data_db[21][3] =
+  {
+    { 0x1.9a5e3cbe1985ep-4, 0x1.01492f72f984bp+0, -0x1p-107 },
+    { 0x1.52a11832e847dp-3, 0x1.0381e68cac923p+0, 0x1p-104 },
+    { 0x1.bf0305e2c6c37p-3, 0x1.061f4c39e16f2p+0, 0x1p-107 },
+    { 0x1.17326ffc09f68p-2, 0x1.099318a43ac8p+0, 0x1p-104 },
+    { 0x1.3d27bf16d8bdbp-2, 0x1.0c6091056e06ap+0, -0x1p-107 },
+    { 0x1.03923f2b47c07p-1, 0x1.219c1989e3373p+0, -0x1p-54 },
+    { 0x1.a6031cd5f93bap-1, 0x1.5bff041b260fep+0, -0x1p-107 },
+    { 0x1.104b648f113a1p+0, 0x1.9efdca62b700ap+0, -0x1p-109 },
+    { 0x1.1585720f35cd9p+0, 0x1.a5bf3acfde4b2p+0, 0x1p-105 },
+    { 0x1.e9cc7ed2e1a7ep+0, 0x1.bb0ff220d8eb5p+1, -0x1p-53 },
+    { 0x1.43180ea854696p+1, 0x1.91f1122b6b63ap+2, 0x1p-102 },
+    { 0x1.725811dcf6782p+2, 0x1.45ea160ddc71fp+7, -0x1p-100 },
+    { 0x1.5afd56f7d565bp+3, 0x1.8ff8e0ccea7cp+14, 0x1p-90 },
+    { 0x1.759a2ad4c4d56p+3, 0x1.cb62eec26bd78p+15, -0x1p-92 },
+    { 0x1.7fce95ea5c653p+3, 0x1.3bf8009648dcp+16, 0x1p-88 },
+    { 0x1.743d5609348acp+4, 0x1.7a87a8bb7fa28p+32, -0x1p-22 },
+    { 0x1.e07e71bfcf06fp+5, 0x1.91ec4412c344fp+85, 0x1p-24 },
+    { 0x1.6474c604cc0d7p+6, 0x1.7a8f65ad009bdp+127, -0x1p+20 },
+    { 0x1.54cd1fea7663ap+7, 0x1.c90810d354618p+244, 0x1p+135 },
+    { 0x1.2da9e5e6af0bp+8, 0x1.27d6fe867d6f6p+434, 0x1p+329 },
+    { 0x1.d6479eba7c971p+8, 0x1.62a88613629b6p+677, -0x1p+568 },
+  };
diff --git a/sysdeps/ieee754/dbl-64/e_cosh_data.h b/sysdeps/ieee754/dbl-64/e_cosh_data.h
new file mode 100644 (file)
index 0000000..7f663ac
--- /dev/null
@@ -0,0 +1,38 @@
+/* Correctly rounded hyperbolic cosine for binary64 values.
+
+Copyright (c) 2023-2026 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+(https://core-math.gitlabpages.inria.fr/).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#ifndef _E_COSH_DATA_H
+#define _E_COSH_DATA_H
+
+extern const double __cosh_data_ch[][2] attribute_hidden;
+#define CH __cosh_data_ch
+extern const double __cosh_data_cl[] attribute_hidden;
+#define CL __cosh_data_cl
+
+extern const double __cosh_data_db[21][3] attribute_hidden;
+#define DB __cosh_data_db
+
+#endif
diff --git a/sysdeps/ieee754/dbl-64/e_coshsinh_data.c b/sysdeps/ieee754/dbl-64/e_coshsinh_data.c
new file mode 100644 (file)
index 0000000..baf1807
--- /dev/null
@@ -0,0 +1,171 @@
+/* Data definitions used by cosh and sinh implementation.
+
+Copyright (c) 2023-2026 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+(https://core-math.gitlabpages.inria.fr/).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+/*
+  The function sinh(x)/cosh(x) is approximated by a minimax polynomial
+  cosh(x)~1+x^2*P(x^2) for |x|<0.125. For other arguments the
+  identity cosh(x)=(exp(|x|)+exp(-|x|))/2 is used. For |x|<5 both
+  exponents are calculated with slightly higher precision than
+  double. For 5<|x|<36.736801 the exp(-|x|) is rather small and is
+  calculated with double precision but exp(|x|) is calculated with
+  higher than double precision. For 36.736801<|x|<710.47586
+  exp(-|x|) becomes too small and only exp(|x|) is calculated.
+ */
+const double __sinhcosh_t0[][2] =
+  {
+    { 0x0p+0, 0x1p+0 },
+      { -0x1.19083535b085ep-56, 0x1.02c9a3e778061p+0 },
+      { 0x1.d73e2a475b466p-55, 0x1.059b0d3158574p+0 },
+      { 0x1.186be4bb285p-57, 0x1.0874518759bc8p+0 },
+      { 0x1.8a62e4adc610ap-54, 0x1.0b5586cf9890fp+0 },
+      { 0x1.03a1727c57b52p-59, 0x1.0e3ec32d3d1a2p+0 },
+      { -0x1.6c51039449b3ap-54, 0x1.11301d0125b51p+0 },
+      { -0x1.32fbf9af1369ep-54, 0x1.1429aaea92dep+0 },
+      { -0x1.19041b9d78a76p-55, 0x1.172b83c7d517bp+0 },
+      { 0x1.e5b4c7b4968e4p-55, 0x1.1a35beb6fcb75p+0 },
+      { 0x1.e016e00a2643cp-54, 0x1.1d4873168b9aap+0 },
+      { 0x1.dc775814a8494p-55, 0x1.2063b88628cd6p+0 },
+      { 0x1.9b07eb6c70572p-54, 0x1.2387a6e756238p+0 },
+      { 0x1.2bd339940e9dap-55, 0x1.26b4565e27cddp+0 },
+      { 0x1.612e8afad1256p-55, 0x1.29e9df51fdee1p+0 },
+      { 0x1.0024754db41d4p-54, 0x1.2d285a6e4030bp+0 },
+      { 0x1.6f46ad23182e4p-55, 0x1.306fe0a31b715p+0 },
+      { 0x1.32721843659a6p-54, 0x1.33c08b26416ffp+0 },
+      { -0x1.63aeabf42eae2p-54, 0x1.371a7373aa9cbp+0 },
+      { -0x1.5e436d661f5e2p-56, 0x1.3a7db34e59ff7p+0 },
+      { 0x1.ada0911f09ebcp-55, 0x1.3dea64c123422p+0 },
+      { -0x1.ef3691c309278p-58, 0x1.4160a21f72e2ap+0 },
+      { 0x1.89b7a04ef80dp-59, 0x1.44e086061892dp+0 },
+      { 0x1.3c1a3b69062fp-56, 0x1.486a2b5c13cdp+0 },
+      { 0x1.d4397afec42e2p-56, 0x1.4bfdad5362a27p+0 },
+      { -0x1.4b309d25957e4p-54, 0x1.4f9b2769d2ca7p+0 },
+      { -0x1.07abe1db13cacp-55, 0x1.5342b569d4f82p+0 },
+      { 0x1.9bb2c011d93acp-54, 0x1.56f4736b527dap+0 },
+      { 0x1.6324c054647acp-54, 0x1.5ab07dd485429p+0 },
+      { 0x1.ba6f93080e65ep-54, 0x1.5e76f15ad2148p+0 },
+      { -0x1.383c17e40b496p-54, 0x1.6247eb03a5585p+0 },
+      { -0x1.bb60987591c34p-54, 0x1.6623882552225p+0 },
+      { -0x1.bdd3413b26456p-54, 0x1.6a09e667f3bcdp+0 },
+      { -0x1.bbe3a683c88aap-57, 0x1.6dfb23c651a2fp+0 },
+      { -0x1.16e4786887a9ap-55, 0x1.71f75e8ec5f74p+0 },
+      { -0x1.0245957316dd4p-54, 0x1.75feb564267c9p+0 },
+      { -0x1.41577ee04993p-55, 0x1.7a11473eb0187p+0 },
+      { 0x1.05d02ba15797ep-56, 0x1.7e2f336cf4e62p+0 },
+      { -0x1.d4c1dd41532d8p-54, 0x1.82589994cce13p+0 },
+      { -0x1.fc6f89bd4f6bap-54, 0x1.868d99b4492edp+0 },
+      { 0x1.6e9f156864b26p-54, 0x1.8ace5422aa0dbp+0 },
+      { 0x1.5cc13a2e3976cp-55, 0x1.8f1ae99157736p+0 },
+      { -0x1.75fc781b57ebcp-57, 0x1.93737b0cdc5e5p+0 },
+      { -0x1.d185b7c1b85dp-54, 0x1.97d829fde4e5p+0 },
+      { 0x1.c7c46b071f2bep-56, 0x1.9c49182a3f09p+0 },
+      { -0x1.359495d1cd532p-54, 0x1.a0c667b5de565p+0 },
+      { -0x1.d2f6edb8d41e2p-54, 0x1.a5503b23e255dp+0 },
+      { 0x1.0fac90ef7fd32p-54, 0x1.a9e6b5579fdbfp+0 },
+      { 0x1.7a1cd345dcc82p-54, 0x1.ae89f995ad3adp+0 },
+      { -0x1.2805e3084d708p-57, 0x1.b33a2b84f15fbp+0 },
+      { -0x1.5584f7e54ac3ap-56, 0x1.b7f76f2fb5e47p+0 },
+      { 0x1.23dd07a2d9e84p-55, 0x1.bcc1e904bc1d2p+0 },
+      { 0x1.11065895048dep-55, 0x1.c199bdd85529cp+0 },
+      { 0x1.2884dff483cacp-54, 0x1.c67f12e57d14bp+0 },
+      { 0x1.503cbd1e949dcp-56, 0x1.cb720dcef9069p+0 },
+      { -0x1.cbc3743797a9cp-54, 0x1.d072d4a07897cp+0 },
+      { 0x1.2ed02d75b3706p-55, 0x1.d5818dcfba487p+0 },
+      { 0x1.c2300696db532p-54, 0x1.da9e603db3285p+0 },
+      { -0x1.1a5cd4f184b5cp-54, 0x1.dfc97337b9b5fp+0 },
+      { 0x1.39e8980a9cc9p-55, 0x1.e502ee78b3ff6p+0 },
+      { -0x1.e9c23179c2894p-54, 0x1.ea4afa2a490dap+0 },
+      { 0x1.dc7f486a4b6bp-54, 0x1.efa1bee615a27p+0 },
+      { 0x1.9d3e12dd8a18ap-54, 0x1.f50765b6e454p+0 },
+      { 0x1.74853f3a5931ep-55, 0x1.fa7c1819e90d8p+0 }
+  };
+
+const double __sinhcosh_t1[][2] =
+  {
+    { 0x0p+0, 0x1p+0 },
+    { 0x1.ae8e38c59c72ap-54, 0x1.000b175effdc7p+0 },
+    { -0x1.7b5d0d58ea8f4p-58, 0x1.00162f3904052p+0 },
+    { 0x1.4115cb6b16a8ep-54, 0x1.0021478e11ce6p+0 },
+    { -0x1.d7c96f201bb2ep-55, 0x1.002c605e2e8cfp+0 },
+    { 0x1.84711d4c35eap-54, 0x1.003779a95f959p+0 },
+    { -0x1.0484245243778p-55, 0x1.0042936faa3d8p+0 },
+    { -0x1.4b237da2025fap-54, 0x1.004dadb113dap+0 },
+    { -0x1.5e00e62d6b30ep-56, 0x1.0058c86da1c0ap+0 },
+    { 0x1.a1d6cedbb948p-54, 0x1.0063e3a559473p+0 },
+    { -0x1.4acf197a00142p-54, 0x1.006eff583fc3dp+0 },
+    { -0x1.eaf2ea42391a6p-57, 0x1.007a1b865a8cap+0 },
+    { 0x1.da93f90835f76p-56, 0x1.0085382faef83p+0 },
+    { -0x1.6a79084ab093cp-55, 0x1.00905554425d4p+0 },
+    { 0x1.86364f8fbe8f8p-54, 0x1.009b72f41a12bp+0 },
+    { -0x1.82e8e14e3110ep-55, 0x1.00a6910f3b6fdp+0 },
+    { -0x1.4f6b2a7609f72p-55, 0x1.00b1afa5abcbfp+0 },
+    { -0x1.e1a258ea8f71ap-56, 0x1.00bcceb7707ecp+0 },
+    { 0x1.4362ca5bc26f2p-56, 0x1.00c7ee448ee02p+0 },
+    { 0x1.095a56c919d02p-54, 0x1.00d30e4d0c483p+0 },
+    { -0x1.406ac4e81a646p-57, 0x1.00de2ed0ee0f5p+0 },
+    { 0x1.b5a6902767e08p-54, 0x1.00e94fd0398ep+0 },
+    { -0x1.91b206085932p-54, 0x1.00f4714af41d3p+0 },
+    { 0x1.427068ab22306p-55, 0x1.00ff93412315cp+0 },
+    { 0x1.c1d0660524e08p-54, 0x1.010ab5b2cbd11p+0 },
+    { -0x1.e7bdfb3204be8p-54, 0x1.0115d89ff3a8bp+0 },
+    { 0x1.843aa8b9cbbc6p-55, 0x1.0120fc089ff63p+0 },
+    { -0x1.34104ee7edae8p-56, 0x1.012c1fecd613bp+0 },
+    { -0x1.2b6aeb6176892p-56, 0x1.0137444c9b5b5p+0 },
+    { 0x1.a8cd33b8a1bb2p-56, 0x1.01426927f5278p+0 },
+    { 0x1.2edc08e5da99ap-56, 0x1.014d8e7ee8d2fp+0 },
+    { 0x1.57ba2dc7e0c72p-55, 0x1.0158b4517bb88p+0 },
+    { 0x1.b61299ab8cdb8p-54, 0x1.0163da9fb3335p+0 },
+    { -0x1.90565902c5f44p-54, 0x1.016f0169949edp+0 },
+    { 0x1.70fc41c5c2d54p-55, 0x1.017a28af25567p+0 },
+    { 0x1.4b9a6e145d76cp-54, 0x1.018550706ab62p+0 },
+    { -0x1.008eff5142bfap-56, 0x1.019078ad6a19fp+0 },
+    { -0x1.77669f033c7dep-54, 0x1.019ba16628de2p+0 },
+    { -0x1.09bb78eeead0ap-54, 0x1.01a6ca9aac5f3p+0 },
+    { 0x1.371231477ece6p-54, 0x1.01b1f44af9f9ep+0 },
+    { 0x1.5e7626621eb5ap-56, 0x1.01bd1e77170b4p+0 },
+    { -0x1.bc72b100828a4p-54, 0x1.01c8491f08f08p+0 },
+    { -0x1.ce39cbbab8bbep-57, 0x1.01d37442d507p+0 },
+    { 0x1.16996709da2e2p-55, 0x1.01de9fe280ac8p+0 },
+    { -0x1.c11f5239bf536p-55, 0x1.01e9cbfe113efp+0 },
+    { 0x1.e1d4eb5edc6b4p-55, 0x1.01f4f8958c1c6p+0 },
+    { -0x1.afb99946ee3fp-54, 0x1.020025a8f6a35p+0 },
+    { -0x1.8f06d8a148a32p-54, 0x1.020b533856324p+0 },
+    { -0x1.2bf310fc54eb6p-55, 0x1.02168143b0281p+0 },
+    { -0x1.c95a035eb4176p-54, 0x1.0221afcb09e3ep+0 },
+    { -0x1.491793e46834cp-54, 0x1.022cdece68c4fp+0 },
+    { -0x1.3e8d0d9c4909p-56, 0x1.02380e4dd22adp+0 },
+    { -0x1.314aa16278aa4p-54, 0x1.02433e494b755p+0 },
+    { 0x1.48daf888e965p-55, 0x1.024e6ec0da046p+0 },
+    { 0x1.56dc8046821f4p-55, 0x1.02599fb483385p+0 },
+    { 0x1.45b42356b9d46p-54, 0x1.0264d1244c719p+0 },
+    { -0x1.082ef51b61d7ep-56, 0x1.027003103b10ep+0 },
+    { 0x1.2106ed0920a34p-56, 0x1.027b357854772p+0 },
+    { -0x1.fd4cf26ea5d0ep-54, 0x1.0286685c9e059p+0 },
+    { -0x1.09f8775e78084p-54, 0x1.02919bbd1d1d8p+0 },
+    { 0x1.64cbba902ca28p-58, 0x1.029ccf99d720ap+0 },
+    { 0x1.4383ef231d206p-54, 0x1.02a803f2d170dp+0 },
+    { 0x1.4a47a505b3a46p-54, 0x1.02b338c811703p+0 },
+    { 0x1.e47120223468p-54, 0x1.02be6e199c811p+0 },
+  };
diff --git a/sysdeps/ieee754/dbl-64/e_coshsinh_data.h b/sysdeps/ieee754/dbl-64/e_coshsinh_data.h
new file mode 100644 (file)
index 0000000..f992417
--- /dev/null
@@ -0,0 +1,35 @@
+/* Correctly rounded hyperbolic sine for binary64 values.
+
+Copyright (c) 2023-2026 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+(https://core-math.gitlabpages.inria.fr/).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#ifndef _E_COSHSINH_DATA_H
+#define _E_COSHSINH_DATA_H
+
+extern const double __sinhcosh_t0[][2] attribute_hidden;
+#define T0 __sinhcosh_t0
+extern const double __sinhcosh_t1[][2] attribute_hidden;
+#define T1 __sinhcosh_t1
+
+#endif
index 247411917691d733ab06a55f1d26b507db329f51..fdec3eab2db5cc1dc0067e6d9e3f88676c27beea 100644 (file)
@@ -31,6 +31,8 @@ SOFTWARE.
 #include <libm-alias-double.h>
 #include <math-svid-compat.h>
 #include <ddcoremath.h>
+#include "e_sinh_data.h"
+#include "e_coshsinh_data.h"
 #include "math_config.h"
 
 #ifndef SECTION
@@ -85,19 +87,11 @@ as_exp_accurate (double x, double t, double th, double tl, double *l)
 static double __attribute__ ((noinline))
 as_sinh_zero (double x)
 {
-  static const double ch[][2] =
-    {
-      { 0x1.5555555555555p-3, 0x1.555555555552fp-57 },
-      { 0x1.1111111111111p-7, 0x1.11111115cf00dp-63 },
-      { 0x1.a01a01a01a01ap-13, 0x1.a0011c925b85cp-73 },
-      { 0x1.71de3a556c734p-19, -0x1.b4e2835532bcdp-73 },
-      { 0x1.ae64567f54482p-26, -0x1.defcf17a6ab79p-81 }
-    };
   double x2 = x * x, x2l = fma (x, x, -x2);
   double y2 = x2
              * (0x1.6124613aef206p-33
                 + x2 * (0x1.ae7f36beea815p-41 + x2 * 0x1.95785063cd974p-49));
-  double y1 = polydd_sinh (x2, x2l, 5, ch, &y2);
+  double y1 = polydd_sinh (x2, x2l, 5, CH, &y2);
   y1 = mulddd3 (y1, y2, x, &y2);
   y1 = muldd2 (y1, y2, x2, x2l, &y2);
   double y0 = fasttwosum (x, y1, &y1);
@@ -118,69 +112,15 @@ as_sinh_zero (double x)
 static __attribute__ ((noinline)) double
 as_sinh_database (double x, double f)
 {
-  static const double db[][3] =
-    {
-      { 0x1.364303e1ad8f6p-2, 0x1.3b07e0c779ddap-2, -0x1.bcp-106 },
-      { 0x1.4169f234f23b9p-2, 0x1.46b7b3b358f99p-2, -0x1p-56 },
-      { 0x1.616cc75d49226p-2, 0x1.687bd068c1c1ep-2, 0x1.ap-111 },
-      { 0x1.ae3773250e7d2p-2, 0x1.bafc3479fc9ccp-2, -0x1p-105 },
-      { 0x1.b7efa91915c95p-2, 0x1.c59869f17b483p-2, -0x1p-104 },
-      { 0x1.d68039861ab53p-2, 0x1.e73b46abb01e1p-2, -0x1.2p-109 },
-      { 0x1.e90f16eb88c09p-2, 0x1.fbdd4a37760b7p-2, -0x1.f8p-108 },
-      { 0x1.a3fc7e4dd47d1p-1, 0x1.d4b21ebf542fp-1, 0x1.ep-107 },
-      { 0x1.aa3b649a96091p-1, 0x1.dd32c5ed1e93p-1, 0x1.8ap-106 },
-      { 0x1.c13876341b62ep-1, 0x1.fd1d7f1c8170cp-1, 0x1.72p-105 },
-      { 0x1.2f5d3b178914ap+0, 0x1.7b8516ffd2406p+0, -0x1.28p-104 },
-      { 0x1.3ffc12b81cbc2p+0, 0x1.9a0ff413a1af3p+0, 0x1.cp-107 },
-      { 0x1.44f65dff00782p+0, 0x1.a38a3c3227609p+0, -0x1p-103 },
-      { 0x1.7346e3c591a14p+0, 0x1.01e9cfa77b855p+1, 0x1.p-102 },
-      { 0x1.b6e2c73f41415p+0, 0x1.57e377b3f0b4bp+1, -0x1p-102 },
-      { 0x1.dc5059d4e507dp+0, 0x1.9168c60ed5256p+1, 0x1.c6p-104 },
-      { 0x1.f737f1e8378c7p+0, 0x1.bffd3f94f40fbp+1, 0x1.a4p-104 },
-      { 0x1.3359640329982p+1, 0x1.5e40df3f985bep+2, 0x1.97p-102 },
-      { 0x1.58a4ff5adac35p+1, 0x1.d671928665bddp+2, 0x1p-102 },
-      { 0x1.8c0a26d055288p+1, 0x1.6056b06a21918p+3, -0x1.bep-102 },
-      { 0x1.bc3c2d0c95f52p+1, 0x1.00fef7383a978p+4, 0x1.61p-100 },
-      { 0x1.0a19aebb51e9p+3, 0x1.fee8f69c4cd25p+10, 0x1.48p-95 },
-      { 0x1.3eb8f61734227p+3, 0x1.4ab1cf45e4e26p+13, 0x1p-90 },
-      { 0x1.43a81752eabe7p+3, 0x1.81d364845ecfap+13, -0x1p-90 },
-      { 0x1.16369cd53bb69p+4, 0x1.0fbc6c02b1c9p+24, -0x1.9p-81 },
-      { 0x1.20e29ea8b51e2p+4, 0x1.08b8abba28abcp+25, 0x1.9bp-79 },
-      { 0x1.92a5c27afbe82p+4, 0x1.3c81f9a247253p+35, 0x1p-67 },
-      { 0x1.a1e4f11b513d7p+4, 0x1.9a65b6c2e2185p+36, -0x1.bcp-70 },
-      { 0x1.c089fcf166171p+4, 0x1.5c452e0e37569p+39, 0x1.4p-69 },
-      { 0x1.e42a98b3a0be5p+4, 0x1.938768ca4f8aap+42, 0x1.6dp-62 },
-      { 0x1.04db52248cbb8p+5, 0x1.0794072349523p+46, 0x1.0e8p-57 },
-      { 0x1.21bc021eeb97ep+5, 0x1.3065064a170fbp+51, 0x1.088p-52 },
-      { 0x1.39fc4d3bb711p+5, 0x1.8a4e90733b95ep+55, 0x1.6ep-50 },
-      { 0x1.3c895d86e96c9p+5, 0x1.0f33837882a6p+56, -0x1.28p-49 },
-      { 0x1.e07e71bfcf06fp+5, 0x1.91ec4412c344fp+85, 0x1p-24 },
-      { 0x1.f7216c4b435c9p+5, 0x1.a97e7be23e65ap+89, -0x1p-15 },
-      { 0x1.6474c604cc0d7p+6, 0x1.7a8f65ad009bdp+127, -0x1.08p+20 },
-      { 0x1.7a60ee15e3e9dp+6, 0x1.62e4dc3bbf53fp+135, 0x1.bp+29 },
-      { 0x1.1f0da93354198p+7, 0x1.0bd73b73fc74cp+206, 0x1.59p+102 },
-      { 0x1.54cd1fea7663ap+7, 0x1.c90810d354618p+244, 0x1.2p+135 },
-      { 0x1.556c678d5e976p+7, 0x1.37e7ac4e7f9b3p+245, 0x1.02p+141 },
-      { 0x1.7945e34b18a9ap+7, 0x1.1b0e4936a8c9bp+271, -0x1.fap+166 },
-      { 0x1.2da9e5e6af0bp+8, 0x1.27d6fe867d6f6p+434, 0x1.0ap+329 },
-      { 0x1.54ceba01331d5p+8, 0x1.9a86785b5ef3ep+490, -0x1.22p+386 },
-      { 0x1.9e7b643238a14p+8, 0x1.f5da7fe652978p+596, 0x1p+493 },
-      { 0x1.c7206c1b753e4p+8, 0x1.8670de0b68cadp+655, -0x1.78p+548 },
-      { 0x1.d6479eba7c971p+8, 0x1.62a88613629b6p+677, -0x1.4p+568 },
-      { 0x1.eb9914d4ac1c8p+8, 0x1.2b67eff65dce8p+708, -0x1.02p+603 },
-      { 0x1.0bc04af1b09f5p+9, 0x1.7b1d97c902985p+771, 0x1.56p+666 },
-      { 0x1.26ee1a46d8c8bp+9, 0x1.fbe20477df4a7p+849, -0x1.55p+745 },
-      { 0x1.4a869881f72acp+9, 0x1.9ea7540a3d1f9p+952, -0x1.2dp+848 },
-  };
-  int a = 0, b = array_length (db) - 1, m = (a + b) / 2;
+  int a = 0, b = array_length (DB) - 1, m = (a + b) / 2;
   double ax = fabs (x);
   while (a <= b)
     {
-      if (db[m][0] < ax)
+      if (DB[m][0] < ax)
        a = m + 1;
-      else if (db[m][0] == ax)
+      else if (DB[m][0] == ax)
        {
-         f = copysign (1, x) * db[m][1] + copysign (1, x) * db[m][2];
+         f = copysign (1, x) * DB[m][1] + copysign (1, x) * DB[m][2];
          break;
        }
       else
@@ -194,151 +134,6 @@ SECTION
 double
 __sinh (double x)
 {
-  /*
-    The function sinh(x) is approximated by a minimax polynomial for
-    |x|<0.25. For other arguments the identity
-    sinh(x)=(exp(|x|)-exp(-|x|))/2*copysign(1,x) is used. For |x|<5
-    both exponents are calculated with slightly higher precision than
-    double. For 5<|x|<36.736801 the exp(-|x|) is small and is
-    calculated with double precision but exp(|x|) is calculated with
-    higher than double precision. For 36.736801<|x|<710.47586
-    exp(-|x|) becomes too small and only exp(|x|) is calculated.
-   */
-  static const double t0[][2] =
-    {
-      { 0x0p+0, 0x1p+0 },
-      { -0x1.19083535b085ep-56, 0x1.02c9a3e778061p+0 },
-      { 0x1.d73e2a475b466p-55, 0x1.059b0d3158574p+0 },
-      { 0x1.186be4bb285p-57, 0x1.0874518759bc8p+0 },
-      { 0x1.8a62e4adc610ap-54, 0x1.0b5586cf9890fp+0 },
-      { 0x1.03a1727c57b52p-59, 0x1.0e3ec32d3d1a2p+0 },
-      { -0x1.6c51039449b3ap-54, 0x1.11301d0125b51p+0 },
-      { -0x1.32fbf9af1369ep-54, 0x1.1429aaea92dep+0 },
-      { -0x1.19041b9d78a76p-55, 0x1.172b83c7d517bp+0 },
-      { 0x1.e5b4c7b4968e4p-55, 0x1.1a35beb6fcb75p+0 },
-      { 0x1.e016e00a2643cp-54, 0x1.1d4873168b9aap+0 },
-      { 0x1.dc775814a8494p-55, 0x1.2063b88628cd6p+0 },
-      { 0x1.9b07eb6c70572p-54, 0x1.2387a6e756238p+0 },
-      { 0x1.2bd339940e9dap-55, 0x1.26b4565e27cddp+0 },
-      { 0x1.612e8afad1256p-55, 0x1.29e9df51fdee1p+0 },
-      { 0x1.0024754db41d4p-54, 0x1.2d285a6e4030bp+0 },
-      { 0x1.6f46ad23182e4p-55, 0x1.306fe0a31b715p+0 },
-      { 0x1.32721843659a6p-54, 0x1.33c08b26416ffp+0 },
-      { -0x1.63aeabf42eae2p-54, 0x1.371a7373aa9cbp+0 },
-      { -0x1.5e436d661f5e2p-56, 0x1.3a7db34e59ff7p+0 },
-      { 0x1.ada0911f09ebcp-55, 0x1.3dea64c123422p+0 },
-      { -0x1.ef3691c309278p-58, 0x1.4160a21f72e2ap+0 },
-      { 0x1.89b7a04ef80dp-59, 0x1.44e086061892dp+0 },
-      { 0x1.3c1a3b69062fp-56, 0x1.486a2b5c13cdp+0 },
-      { 0x1.d4397afec42e2p-56, 0x1.4bfdad5362a27p+0 },
-      { -0x1.4b309d25957e4p-54, 0x1.4f9b2769d2ca7p+0 },
-      { -0x1.07abe1db13cacp-55, 0x1.5342b569d4f82p+0 },
-      { 0x1.9bb2c011d93acp-54, 0x1.56f4736b527dap+0 },
-      { 0x1.6324c054647acp-54, 0x1.5ab07dd485429p+0 },
-      { 0x1.ba6f93080e65ep-54, 0x1.5e76f15ad2148p+0 },
-      { -0x1.383c17e40b496p-54, 0x1.6247eb03a5585p+0 },
-      { -0x1.bb60987591c34p-54, 0x1.6623882552225p+0 },
-      { -0x1.bdd3413b26456p-54, 0x1.6a09e667f3bcdp+0 },
-      { -0x1.bbe3a683c88aap-57, 0x1.6dfb23c651a2fp+0 },
-      { -0x1.16e4786887a9ap-55, 0x1.71f75e8ec5f74p+0 },
-      { -0x1.0245957316dd4p-54, 0x1.75feb564267c9p+0 },
-      { -0x1.41577ee04993p-55, 0x1.7a11473eb0187p+0 },
-      { 0x1.05d02ba15797ep-56, 0x1.7e2f336cf4e62p+0 },
-      { -0x1.d4c1dd41532d8p-54, 0x1.82589994cce13p+0 },
-      { -0x1.fc6f89bd4f6bap-54, 0x1.868d99b4492edp+0 },
-      { 0x1.6e9f156864b26p-54, 0x1.8ace5422aa0dbp+0 },
-      { 0x1.5cc13a2e3976cp-55, 0x1.8f1ae99157736p+0 },
-      { -0x1.75fc781b57ebcp-57, 0x1.93737b0cdc5e5p+0 },
-      { -0x1.d185b7c1b85dp-54, 0x1.97d829fde4e5p+0 },
-      { 0x1.c7c46b071f2bep-56, 0x1.9c49182a3f09p+0 },
-      { -0x1.359495d1cd532p-54, 0x1.a0c667b5de565p+0 },
-      { -0x1.d2f6edb8d41e2p-54, 0x1.a5503b23e255dp+0 },
-      { 0x1.0fac90ef7fd32p-54, 0x1.a9e6b5579fdbfp+0 },
-      { 0x1.7a1cd345dcc82p-54, 0x1.ae89f995ad3adp+0 },
-      { -0x1.2805e3084d708p-57, 0x1.b33a2b84f15fbp+0 },
-      { -0x1.5584f7e54ac3ap-56, 0x1.b7f76f2fb5e47p+0 },
-      { 0x1.23dd07a2d9e84p-55, 0x1.bcc1e904bc1d2p+0 },
-      { 0x1.11065895048dep-55, 0x1.c199bdd85529cp+0 },
-      { 0x1.2884dff483cacp-54, 0x1.c67f12e57d14bp+0 },
-      { 0x1.503cbd1e949dcp-56, 0x1.cb720dcef9069p+0 },
-      { -0x1.cbc3743797a9cp-54, 0x1.d072d4a07897cp+0 },
-      { 0x1.2ed02d75b3706p-55, 0x1.d5818dcfba487p+0 },
-      { 0x1.c2300696db532p-54, 0x1.da9e603db3285p+0 },
-      { -0x1.1a5cd4f184b5cp-54, 0x1.dfc97337b9b5fp+0 },
-      { 0x1.39e8980a9cc9p-55, 0x1.e502ee78b3ff6p+0 },
-      { -0x1.e9c23179c2894p-54, 0x1.ea4afa2a490dap+0 },
-      { 0x1.dc7f486a4b6bp-54, 0x1.efa1bee615a27p+0 },
-      { 0x1.9d3e12dd8a18ap-54, 0x1.f50765b6e454p+0 },
-      { 0x1.74853f3a5931ep-55, 0x1.fa7c1819e90d8p+0 }
-    };
-  static const double t1[][2] =
-    {
-      { 0x0p+0, 0x1p+0 },
-      { 0x1.ae8e38c59c72ap-54, 0x1.000b175effdc7p+0 },
-      { -0x1.7b5d0d58ea8f4p-58, 0x1.00162f3904052p+0 },
-      { 0x1.4115cb6b16a8ep-54, 0x1.0021478e11ce6p+0 },
-      { -0x1.d7c96f201bb2ep-55, 0x1.002c605e2e8cfp+0 },
-      { 0x1.84711d4c35eap-54, 0x1.003779a95f959p+0 },
-      { -0x1.0484245243778p-55, 0x1.0042936faa3d8p+0 },
-      { -0x1.4b237da2025fap-54, 0x1.004dadb113dap+0 },
-      { -0x1.5e00e62d6b30ep-56, 0x1.0058c86da1c0ap+0 },
-      { 0x1.a1d6cedbb948p-54, 0x1.0063e3a559473p+0 },
-      { -0x1.4acf197a00142p-54, 0x1.006eff583fc3dp+0 },
-      { -0x1.eaf2ea42391a6p-57, 0x1.007a1b865a8cap+0 },
-      { 0x1.da93f90835f76p-56, 0x1.0085382faef83p+0 },
-      { -0x1.6a79084ab093cp-55, 0x1.00905554425d4p+0 },
-      { 0x1.86364f8fbe8f8p-54, 0x1.009b72f41a12bp+0 },
-      { -0x1.82e8e14e3110ep-55, 0x1.00a6910f3b6fdp+0 },
-      { -0x1.4f6b2a7609f72p-55, 0x1.00b1afa5abcbfp+0 },
-      { -0x1.e1a258ea8f71ap-56, 0x1.00bcceb7707ecp+0 },
-      { 0x1.4362ca5bc26f2p-56, 0x1.00c7ee448ee02p+0 },
-      { 0x1.095a56c919d02p-54, 0x1.00d30e4d0c483p+0 },
-      { -0x1.406ac4e81a646p-57, 0x1.00de2ed0ee0f5p+0 },
-      { 0x1.b5a6902767e08p-54, 0x1.00e94fd0398ep+0 },
-      { -0x1.91b206085932p-54, 0x1.00f4714af41d3p+0 },
-      { 0x1.427068ab22306p-55, 0x1.00ff93412315cp+0 },
-      { 0x1.c1d0660524e08p-54, 0x1.010ab5b2cbd11p+0 },
-      { -0x1.e7bdfb3204be8p-54, 0x1.0115d89ff3a8bp+0 },
-      { 0x1.843aa8b9cbbc6p-55, 0x1.0120fc089ff63p+0 },
-      { -0x1.34104ee7edae8p-56, 0x1.012c1fecd613bp+0 },
-      { -0x1.2b6aeb6176892p-56, 0x1.0137444c9b5b5p+0 },
-      { 0x1.a8cd33b8a1bb2p-56, 0x1.01426927f5278p+0 },
-      { 0x1.2edc08e5da99ap-56, 0x1.014d8e7ee8d2fp+0 },
-      { 0x1.57ba2dc7e0c72p-55, 0x1.0158b4517bb88p+0 },
-      { 0x1.b61299ab8cdb8p-54, 0x1.0163da9fb3335p+0 },
-      { -0x1.90565902c5f44p-54, 0x1.016f0169949edp+0 },
-      { 0x1.70fc41c5c2d54p-55, 0x1.017a28af25567p+0 },
-      { 0x1.4b9a6e145d76cp-54, 0x1.018550706ab62p+0 },
-      { -0x1.008eff5142bfap-56, 0x1.019078ad6a19fp+0 },
-      { -0x1.77669f033c7dep-54, 0x1.019ba16628de2p+0 },
-      { -0x1.09bb78eeead0ap-54, 0x1.01a6ca9aac5f3p+0 },
-      { 0x1.371231477ece6p-54, 0x1.01b1f44af9f9ep+0 },
-      { 0x1.5e7626621eb5ap-56, 0x1.01bd1e77170b4p+0 },
-      { -0x1.bc72b100828a4p-54, 0x1.01c8491f08f08p+0 },
-      { -0x1.ce39cbbab8bbep-57, 0x1.01d37442d507p+0 },
-      { 0x1.16996709da2e2p-55, 0x1.01de9fe280ac8p+0 },
-      { -0x1.c11f5239bf536p-55, 0x1.01e9cbfe113efp+0 },
-      { 0x1.e1d4eb5edc6b4p-55, 0x1.01f4f8958c1c6p+0 },
-      { -0x1.afb99946ee3fp-54, 0x1.020025a8f6a35p+0 },
-      { -0x1.8f06d8a148a32p-54, 0x1.020b533856324p+0 },
-      { -0x1.2bf310fc54eb6p-55, 0x1.02168143b0281p+0 },
-      { -0x1.c95a035eb4176p-54, 0x1.0221afcb09e3ep+0 },
-      { -0x1.491793e46834cp-54, 0x1.022cdece68c4fp+0 },
-      { -0x1.3e8d0d9c4909p-56, 0x1.02380e4dd22adp+0 },
-      { -0x1.314aa16278aa4p-54, 0x1.02433e494b755p+0 },
-      { 0x1.48daf888e965p-55, 0x1.024e6ec0da046p+0 },
-      { 0x1.56dc8046821f4p-55, 0x1.02599fb483385p+0 },
-      { 0x1.45b42356b9d46p-54, 0x1.0264d1244c719p+0 },
-      { -0x1.082ef51b61d7ep-56, 0x1.027003103b10ep+0 },
-      { 0x1.2106ed0920a34p-56, 0x1.027b357854772p+0 },
-      { -0x1.fd4cf26ea5d0ep-54, 0x1.0286685c9e059p+0 },
-      { -0x1.09f8775e78084p-54, 0x1.02919bbd1d1d8p+0 },
-      { 0x1.64cbba902ca28p-58, 0x1.029ccf99d720ap+0 },
-      { 0x1.4383ef231d206p-54, 0x1.02a803f2d170dp+0 },
-      { 0x1.4a47a505b3a46p-54, 0x1.02b338c811703p+0 },
-      { 0x1.e47120223468p-54, 0x1.02be6e199c811p+0 },
-  };
-
   const double s = 0x1.71547652b82fep+12;
   double ax = fabs (x), v0 = fma (ax, s, 0x1.8000002p+26);
   uint64_t jt = asuint64 (v0);
@@ -382,8 +177,8 @@ __sinh (double x)
   int64_t j1 = jl & 0x3f, j0 = (jl >> 6) & 0x3f, je = jl >> 12;
   double sp = asdouble ((uint64_t) (1022 + ie) << 52),
         sm = asdouble ((uint64_t) (1022 + je) << 52);
-  double t0h = t0[i0][1], t0l = t0[i0][0];
-  double t1h = t1[i1][1], t1l = t1[i1][0];
+  double t0h = T0[i0][1], t0l = T0[i0][0];
+  double t1h = T1[i1][1], t1l = T1[i1][0];
   double th = t0h * t1h, tl = t0h * t1l + t1h * t0l + fma (t0h, t1h, -th);
   const double l2h = 0x1.62e42ffp-13, l2l = 0x1.718432a1b0e26p-47;
   double dx = (ax - l2h * t) + l2l * t, dx2 = dx * dx, mx = -dx;
@@ -419,7 +214,7 @@ __sinh (double x)
          return th;
        }
       // now 5 < |x| < 36.736801
-      double q0h = t0[j0][1], q1h = t1[j1][1], qh = q0h * q1h;
+      double q0h = T0[j0][1], q1h = T1[j1][1], qh = q0h * q1h;
       th *= sp;
       tl *= sp;
       qh *= sm;
@@ -445,7 +240,7 @@ __sinh (double x)
       else
        { // 5 < |x| <= 31.4
          qh = q0h * q1h;
-         double q0l = t0[j0][0], q1l = t1[j1][0];
+         double q0l = T0[j0][0], q1l = T1[j1][0];
          double ql = q0h * q1l + q1h * q0l + fma (q0h, q1h, -qh);
          qh *= sm;
          ql *= sm;
@@ -456,8 +251,8 @@ __sinh (double x)
     }
   else
     { // 0.25 <= |x| <= 5
-      double q0h = t0[j0][1], q0l = t0[j0][0];
-      double q1h = t1[j1][1], q1l = t1[j1][0];
+      double q0h = T0[j0][1], q0l = T0[j0][0];
+      double q1h = T1[j1][1], q1l = T1[j1][0];
       double qh = q0h * q1h, ql = q0h * q1l + q1h * q0l + fma (q0h, q1h, -qh);
       th *= sp;
       tl *= sp;
diff --git a/sysdeps/ieee754/dbl-64/e_sinh_data.c b/sysdeps/ieee754/dbl-64/e_sinh_data.c
new file mode 100644 (file)
index 0000000..ca61e31
--- /dev/null
@@ -0,0 +1,89 @@
+/* Data definitions used by sinh implementation.
+
+Copyright (c) 2023-2026 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+(https://core-math.gitlabpages.inria.fr/).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#include "e_sinh_data.h"
+
+const double __sinh_data_ch[][2] =
+  {
+    { 0x1.5555555555555p-3, 0x1.555555555552fp-57 },
+    { 0x1.1111111111111p-7, 0x1.11111115cf00dp-63 },
+    { 0x1.a01a01a01a01ap-13, 0x1.a0011c925b85cp-73 },
+    { 0x1.71de3a556c734p-19, -0x1.b4e2835532bcdp-73 },
+    { 0x1.ae64567f54482p-26, -0x1.defcf17a6ab79p-81 }
+  };
+
+const double __sinh_data_db[49][3] =
+  {
+    { 0x1.364303e1ad8f6p-2, 0x1.3b07e0c779ddap-2, -0x1.bcp-106 },
+    { 0x1.4169f234f23b9p-2, 0x1.46b7b3b358f99p-2, -0x1p-56 },
+    { 0x1.616cc75d49226p-2, 0x1.687bd068c1c1ep-2, 0x1.ap-111 },
+    { 0x1.ae3773250e7d2p-2, 0x1.bafc3479fc9ccp-2, -0x1p-105 },
+    { 0x1.d68039861ab53p-2, 0x1.e73b46abb01e1p-2, -0x1.2p-109 },
+    { 0x1.e90f16eb88c09p-2, 0x1.fbdd4a37760b7p-2, -0x1.f8p-108 },
+    { 0x1.a3fc7e4dd47d1p-1, 0x1.d4b21ebf542fp-1, 0x1.ep-107 },
+    { 0x1.aa3b649a96091p-1, 0x1.dd32c5ed1e93p-1, 0x1.8ap-106 },
+    { 0x1.c13876341b62ep-1, 0x1.fd1d7f1c8170cp-1, 0x1.72p-105 },
+    { 0x1.2f5d3b178914ap+0, 0x1.7b8516ffd2406p+0, -0x1.28p-104 },
+    { 0x1.3ffc12b81cbc2p+0, 0x1.9a0ff413a1af3p+0, 0x1.cp-107 },
+    { 0x1.44f65dff00782p+0, 0x1.a38a3c3227609p+0, -0x1p-103 },
+    { 0x1.7346e3c591a14p+0, 0x1.01e9cfa77b855p+1, 0x1.p-102 },
+    { 0x1.b6e2c73f41415p+0, 0x1.57e377b3f0b4bp+1, -0x1p-102 },
+    { 0x1.dc5059d4e507dp+0, 0x1.9168c60ed5256p+1, 0x1.c6p-104 },
+    { 0x1.f737f1e8378c7p+0, 0x1.bffd3f94f40fbp+1, 0x1.a4p-104 },
+    { 0x1.3359640329982p+1, 0x1.5e40df3f985bep+2, 0x1.97p-102 },
+    { 0x1.58a4ff5adac35p+1, 0x1.d671928665bddp+2, 0x1p-102 },
+    { 0x1.8c0a26d055288p+1, 0x1.6056b06a21918p+3, -0x1.bep-102 },
+    { 0x1.bc3c2d0c95f52p+1, 0x1.00fef7383a978p+4, 0x1.61p-100 },
+    { 0x1.0a19aebb51e9p+3, 0x1.fee8f69c4cd25p+10, 0x1.48p-95 },
+    { 0x1.3eb8f61734227p+3, 0x1.4ab1cf45e4e26p+13, 0x1p-90 },
+    { 0x1.43a81752eabe7p+3, 0x1.81d364845ecfap+13, -0x1p-90 },
+    { 0x1.16369cd53bb69p+4, 0x1.0fbc6c02b1c9p+24, -0x1.9p-81 },
+    { 0x1.20e29ea8b51e2p+4, 0x1.08b8abba28abcp+25, 0x1.9bp-79 },
+    { 0x1.a1e4f11b513d7p+4, 0x1.9a65b6c2e2185p+36, -0x1.bcp-70 },
+    { 0x1.c089fcf166171p+4, 0x1.5c452e0e37569p+39, 0x1.4p-69 },
+    { 0x1.e42a98b3a0be5p+4, 0x1.938768ca4f8aap+42, 0x1.6dp-62 },
+    { 0x1.04db52248cbb8p+5, 0x1.0794072349523p+46, 0x1.0e8p-57 },
+    { 0x1.21bc021eeb97ep+5, 0x1.3065064a170fbp+51, 0x1.088p-52 },
+    { 0x1.39fc4d3bb711p+5, 0x1.8a4e90733b95ep+55, 0x1.6ep-50 },
+    { 0x1.3c895d86e96c9p+5, 0x1.0f33837882a6p+56, -0x1.28p-49 },
+    { 0x1.e07e71bfcf06fp+5, 0x1.91ec4412c344fp+85, 0x1p-24 },
+    { 0x1.f7216c4b435c9p+5, 0x1.a97e7be23e65ap+89, -0x1p-15 },
+    { 0x1.6474c604cc0d7p+6, 0x1.7a8f65ad009bdp+127, -0x1.08p+20 },
+    { 0x1.7a60ee15e3e9dp+6, 0x1.62e4dc3bbf53fp+135, 0x1.bp+29 },
+    { 0x1.1f0da93354198p+7, 0x1.0bd73b73fc74cp+206, 0x1.59p+102 },
+    { 0x1.54cd1fea7663ap+7, 0x1.c90810d354618p+244, 0x1.2p+135 },
+    { 0x1.556c678d5e976p+7, 0x1.37e7ac4e7f9b3p+245, 0x1.02p+141 },
+    { 0x1.7945e34b18a9ap+7, 0x1.1b0e4936a8c9bp+271, -0x1.fap+166 },
+    { 0x1.2da9e5e6af0bp+8, 0x1.27d6fe867d6f6p+434, 0x1.0ap+329 },
+    { 0x1.54ceba01331d5p+8, 0x1.9a86785b5ef3ep+490, -0x1.22p+386 },
+    { 0x1.9e7b643238a14p+8, 0x1.f5da7fe652978p+596, 0x1p+493 },
+    { 0x1.c7206c1b753e4p+8, 0x1.8670de0b68cadp+655, -0x1.78p+548 },
+    { 0x1.d6479eba7c971p+8, 0x1.62a88613629b6p+677, -0x1.4p+568 },
+    { 0x1.eb9914d4ac1c8p+8, 0x1.2b67eff65dce8p+708, -0x1.02p+603 },
+    { 0x1.0bc04af1b09f5p+9, 0x1.7b1d97c902985p+771, 0x1.56p+666 },
+    { 0x1.26ee1a46d8c8bp+9, 0x1.fbe20477df4a7p+849, -0x1.55p+745 },
+    { 0x1.4a869881f72acp+9, 0x1.9ea7540a3d1f9p+952, -0x1.2dp+848 },
+  };
diff --git a/sysdeps/ieee754/dbl-64/e_sinh_data.h b/sysdeps/ieee754/dbl-64/e_sinh_data.h
new file mode 100644 (file)
index 0000000..16f7e0d
--- /dev/null
@@ -0,0 +1,35 @@
+/* Data definitions used by sinh implementation.
+
+Copyright (c) 2023-2026 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+(https://core-math.gitlabpages.inria.fr/).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#ifndef _E_SINH_DATA_H
+#define _E_SINH_DATA_H
+
+extern const double __sinh_data_ch[][2] attribute_hidden;
+#define CH __sinh_data_ch
+extern const double __sinh_data_db[49][3] attribute_hidden;
+#define DB __sinh_data_db
+
+#endif
diff --git a/sysdeps/ieee754/dbl-64/e_tanh_data.c b/sysdeps/ieee754/dbl-64/e_tanh_data.c
new file mode 100644 (file)
index 0000000..0ebd827
--- /dev/null
@@ -0,0 +1,63 @@
+/* Data definitions used by tanh implementation.
+
+Copyright (c) 2023-2026 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+(https://core-math.gitlabpages.inria.fr/).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#include "e_tanh_data.h"
+
+const double __tanh_data_ch[][2] =
+  {
+    { -0x1.5555555555555p-2, -0x1.5555555555555p-56 },
+    { 0x1.1111111111111p-3, 0x1.1111111110916p-59 },
+    { -0x1.ba1ba1ba1ba1cp-5, 0x1.7917917a46f2cp-59 },
+    { 0x1.664f4882c10fap-6, -0x1.9a52a06f1e599p-63 },
+    { -0x1.226e355e6c23dp-7, 0x1.c297394c24e38p-61 },
+    { 0x1.d6d3d0e157dep-9, -0x1.311087e5b1526p-63 },
+    { -0x1.7da36452b75e1p-10, -0x1.2868cde54ea0cp-65 },
+    { 0x1.355824803667bp-11, 0x1.2cd8fc406c3f7p-66 },
+    { -0x1.f57d7734c821dp-13, 0x1.da22861b4ca8p-70 },
+    { 0x1.967e18ad3facfp-14, -0x1.0831108273a74p-68 }
+  };
+
+const double __tanh_data_cl[] =
+  {
+    -0x1.497d8e6462927p-15, 0x1.0b1318c243bd7p-16,  -0x1.b0f2935e9a12p-18,
+    0x1.5e9444536e654p-19,  -0x1.174ff2a31908cp-20, 0x1.749698c8d338dp-22
+  };
+
+const double __tanh_data_db[12][3] =
+  {
+    { 0x1.ac343b179fec4p-3, 0x1.a612499c53078p-3, 0x1p-57 },
+    { 0x1.00764a988bf73p-2, 0x1.f676484c0703bp-3, -0x1p-104 },
+    { 0x1.17d1e8a63711fp-2, 0x1.110e96a6c2d96p-2, -0x1p-105 },
+    { 0x1.291c601a05276p-2, 0x1.210b7d0c03743p-2, 0x1p-56 },
+    { 0x1.36f33d51c264dp-2, 0x1.2dbb7b1c91363p-2, -0x1p-106 },
+    { 0x1.43eaea23649c3p-2, 0x1.39877ed028641p-2, -0x1p-55 },
+    { 0x1.d88d7550b2826p-2, 0x1.b9a3637366afdp-2, 0x1p-56 },
+    { 0x1.e611aa58ab608p-2, 0x1.c493dc899e4a6p-2, -0x1p-55 },
+    { 0x1.01efe7ac8c15dp-1, 0x1.dc3fe1b524821p-2, -0x1p-104 },
+    { 0x1.1005ec0bccabbp-1, 0x1.f20b1c8557dedp-2, -0x1p-55 },
+    { 0x1.33dfeb0fa4bfep-1, 0x1.1372f9ee76e99p-1, 0x1p-55 },
+    { 0x1.49f24ac5cac35p-1, 0x1.22c495ff06104p-1, -0x1p-104 },
+  };
diff --git a/sysdeps/ieee754/dbl-64/e_tanh_data.h b/sysdeps/ieee754/dbl-64/e_tanh_data.h
new file mode 100644 (file)
index 0000000..4be829b
--- /dev/null
@@ -0,0 +1,38 @@
+/* Correctly rounded hyperbolic tangent function for binary64 values.
+
+Copyright (c) 2023-2026 Alexei Sibidanov.
+
+This file is part of the CORE-MATH project
+(https://core-math.gitlabpages.inria.fr/).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#ifndef _E_TANH_DATA_H
+#define _E_TANH_DATA_H
+
+extern const double __tanh_data_ch[][2] attribute_hidden;
+#define CH __tanh_data_ch
+extern const double __tanh_data_cl[] attribute_hidden;
+#define CL __tanh_data_cl
+
+extern const double __tanh_data_db[12][3] attribute_hidden;
+#define DB __tanh_data_db
+
+#endif
index 510325097e271750eff1b7b4f6488c2048388ff6..32aba5997f4c883f142480958be6d5ddc1cd5124 100644 (file)
@@ -24,11 +24,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */
 
+#include <array_length.h>
 #include <math.h>
 #include <stdint.h>
 #include <libm-alias-double.h>
 #include <ddcoremath.h>
 #include "math_config.h"
+#include "e_coshsinh_data.h"
+#include "e_tanh_data.h"
 
 static __attribute__((noinline)) double as_tanh_database(double, double);
 
@@ -79,35 +82,16 @@ as_exp_accurate (double x, double t, double th, double tl, double *l)
 static double __attribute__ ((noinline))
 as_tanh_zero (double x)
 { // |x|<0.25
-  static const double ch[][2] =
-    {
-      { -0x1.5555555555555p-2, -0x1.5555555555555p-56 },
-      { 0x1.1111111111111p-3, 0x1.1111111110916p-59 },
-      { -0x1.ba1ba1ba1ba1cp-5, 0x1.7917917a46f2cp-59 },
-      { 0x1.664f4882c10fap-6, -0x1.9a52a06f1e599p-63 },
-      { -0x1.226e355e6c23dp-7, 0x1.c297394c24e38p-61 },
-      { 0x1.d6d3d0e157dep-9, -0x1.311087e5b1526p-63 },
-      { -0x1.7da36452b75e1p-10, -0x1.2868cde54ea0cp-65 },
-      { 0x1.355824803667bp-11, 0x1.2cd8fc406c3f7p-66 },
-      { -0x1.f57d7734c821dp-13, 0x1.da22861b4ca8p-70 },
-      { 0x1.967e18ad3facfp-14, -0x1.0831108273a74p-68 }
-    };
-  static const double cl[] =
-    {
-      -0x1.497d8e6462927p-15, 0x1.0b1318c243bd7p-16,
-      -0x1.b0f2935e9a12p-18,  0x1.5e9444536e654p-19,
-      -0x1.174ff2a31908cp-20, 0x1.749698c8d338dp-22
-    };
   double x2 = x * x, x2l = fma (x, x, -x2);
   double y2
       = x2
-       * (cl[0]
+       * (CL[0]
           + x2
-                * (cl[1]
+                * (CL[1]
                    + x2
-                         * (cl[2]
-                            + x2 * (cl[3] + x2 * (cl[4] + x2 * (cl[5]))))));
-  double y1 = polydd_tanh (x2, x2l, 10, ch, &y2);
+                         * (CL[2]
+                            + x2 * (CL[3] + x2 * (CL[4] + x2 * (CL[5]))))));
+  double y1 = polydd_tanh (x2, x2l, 10, CH, &y2);
   y1 = mulddd (y1, y2, x, &y2);
   y1 = muldd_acc (y1, y2, x2, x2l, &y2);
   double y0 = fasttwosum (x, y1, &y1);
@@ -130,30 +114,16 @@ as_tanh_zero (double x)
 static __attribute__ ((noinline)) double
 as_tanh_database (double x, double f)
 {
-  static const double db[][3] = {
-    { 0x1.ac343b179fec4p-3, 0x1.a612499c53078p-3, 0x1p-57 },
-    { 0x1.00764a988bf73p-2, 0x1.f676484c0703bp-3, -0x1p-104 },
-    { 0x1.17d1e8a63711fp-2, 0x1.110e96a6c2d96p-2, -0x1p-105 },
-    { 0x1.291c601a05276p-2, 0x1.210b7d0c03743p-2, 0x1p-56 },
-    { 0x1.36f33d51c264dp-2, 0x1.2dbb7b1c91363p-2, -0x1p-106 },
-    { 0x1.43eaea23649c3p-2, 0x1.39877ed028641p-2, -0x1p-55 },
-    { 0x1.d88d7550b2826p-2, 0x1.b9a3637366afdp-2, 0x1p-56 },
-    { 0x1.e611aa58ab608p-2, 0x1.c493dc899e4a6p-2, -0x1p-55 },
-    { 0x1.01efe7ac8c15dp-1, 0x1.dc3fe1b524821p-2, -0x1p-104 },
-    { 0x1.1005ec0bccabbp-1, 0x1.f20b1c8557dedp-2, -0x1p-55 },
-    { 0x1.33dfeb0fa4bfep-1, 0x1.1372f9ee76e99p-1, 0x1p-55 },
-    { 0x1.49f24ac5cac35p-1, 0x1.22c495ff06104p-1, -0x1p-104 },
-  };
-  int a = 0, b = sizeof (db) / sizeof (db[0]) - 1, m = (a + b) / 2;
+  int a = 0, b = array_length (DB) - 1, m = (a + b) / 2;
   double ax = fabs (x);
   while (a <= b)
     {
-      if (db[m][0] < ax)
+      if (DB[m][0] < ax)
        a = m + 1;
-      else if (db[m][0] == ax)
+      else if (DB[m][0] == ax)
        {
-         f = copysign (1, x) * db[m][1]
-             + copysign (1, x) * db[m][2];
+         f = copysign (1, x) * DB[m][1]
+             + copysign (1, x) * DB[m][2];
          break;
        }
       else
@@ -171,147 +141,6 @@ SECTION
 double
 __tanh (double x)
 {
-  /*
-    The function tanh(x) is approximated by minimax polynomial for
-    |x|<0.25.  For other values we use this identity tanh(|x|) = 1 -
-    2*exp(-2*|x|)/(1 + exp(-2*|x|)).  For large |x|>3.683 the term
-    2*exp(-2*|x|)/(1 + exp(-2*|x|)) becomes small and we can use less
-    precise formula for exponential.
-  */
-  static const double t0[][2] =
-    {
-      { 0x0p+0, 0x1p+0 },
-      { -0x1.19083535b085ep-56, 0x1.02c9a3e778061p+0 },
-      { 0x1.d73e2a475b466p-55, 0x1.059b0d3158574p+0 },
-      { 0x1.186be4bb285p-57, 0x1.0874518759bc8p+0 },
-      { 0x1.8a62e4adc610ap-54, 0x1.0b5586cf9890fp+0 },
-      { 0x1.03a1727c57b52p-59, 0x1.0e3ec32d3d1a2p+0 },
-      { -0x1.6c51039449b3ap-54, 0x1.11301d0125b51p+0 },
-      { -0x1.32fbf9af1369ep-54, 0x1.1429aaea92dep+0 },
-      { -0x1.19041b9d78a76p-55, 0x1.172b83c7d517bp+0 },
-      { 0x1.e5b4c7b4968e4p-55, 0x1.1a35beb6fcb75p+0 },
-      { 0x1.e016e00a2643cp-54, 0x1.1d4873168b9aap+0 },
-      { 0x1.dc775814a8494p-55, 0x1.2063b88628cd6p+0 },
-      { 0x1.9b07eb6c70572p-54, 0x1.2387a6e756238p+0 },
-      { 0x1.2bd339940e9dap-55, 0x1.26b4565e27cddp+0 },
-      { 0x1.612e8afad1256p-55, 0x1.29e9df51fdee1p+0 },
-      { 0x1.0024754db41d4p-54, 0x1.2d285a6e4030bp+0 },
-      { 0x1.6f46ad23182e4p-55, 0x1.306fe0a31b715p+0 },
-      { 0x1.32721843659a6p-54, 0x1.33c08b26416ffp+0 },
-      { -0x1.63aeabf42eae2p-54, 0x1.371a7373aa9cbp+0 },
-      { -0x1.5e436d661f5e2p-56, 0x1.3a7db34e59ff7p+0 },
-      { 0x1.ada0911f09ebcp-55, 0x1.3dea64c123422p+0 },
-      { -0x1.ef3691c309278p-58, 0x1.4160a21f72e2ap+0 },
-      { 0x1.89b7a04ef80dp-59, 0x1.44e086061892dp+0 },
-      { 0x1.3c1a3b69062fp-56, 0x1.486a2b5c13cdp+0 },
-      { 0x1.d4397afec42e2p-56, 0x1.4bfdad5362a27p+0 },
-      { -0x1.4b309d25957e4p-54, 0x1.4f9b2769d2ca7p+0 },
-      { -0x1.07abe1db13cacp-55, 0x1.5342b569d4f82p+0 },
-      { 0x1.9bb2c011d93acp-54, 0x1.56f4736b527dap+0 },
-      { 0x1.6324c054647acp-54, 0x1.5ab07dd485429p+0 },
-      { 0x1.ba6f93080e65ep-54, 0x1.5e76f15ad2148p+0 },
-      { -0x1.383c17e40b496p-54, 0x1.6247eb03a5585p+0 },
-      { -0x1.bb60987591c34p-54, 0x1.6623882552225p+0 },
-      { -0x1.bdd3413b26456p-54, 0x1.6a09e667f3bcdp+0 },
-      { -0x1.bbe3a683c88aap-57, 0x1.6dfb23c651a2fp+0 },
-      { -0x1.16e4786887a9ap-55, 0x1.71f75e8ec5f74p+0 },
-      { -0x1.0245957316dd4p-54, 0x1.75feb564267c9p+0 },
-      { -0x1.41577ee04993p-55, 0x1.7a11473eb0187p+0 },
-      { 0x1.05d02ba15797ep-56, 0x1.7e2f336cf4e62p+0 },
-      { -0x1.d4c1dd41532d8p-54, 0x1.82589994cce13p+0 },
-      { -0x1.fc6f89bd4f6bap-54, 0x1.868d99b4492edp+0 },
-      { 0x1.6e9f156864b26p-54, 0x1.8ace5422aa0dbp+0 },
-      { 0x1.5cc13a2e3976cp-55, 0x1.8f1ae99157736p+0 },
-      { -0x1.75fc781b57ebcp-57, 0x1.93737b0cdc5e5p+0 },
-      { -0x1.d185b7c1b85dp-54, 0x1.97d829fde4e5p+0 },
-      { 0x1.c7c46b071f2bep-56, 0x1.9c49182a3f09p+0 },
-      { -0x1.359495d1cd532p-54, 0x1.a0c667b5de565p+0 },
-      { -0x1.d2f6edb8d41e2p-54, 0x1.a5503b23e255dp+0 },
-      { 0x1.0fac90ef7fd32p-54, 0x1.a9e6b5579fdbfp+0 },
-      { 0x1.7a1cd345dcc82p-54, 0x1.ae89f995ad3adp+0 },
-      { -0x1.2805e3084d708p-57, 0x1.b33a2b84f15fbp+0 },
-      { -0x1.5584f7e54ac3ap-56, 0x1.b7f76f2fb5e47p+0 },
-      { 0x1.23dd07a2d9e84p-55, 0x1.bcc1e904bc1d2p+0 },
-      { 0x1.11065895048dep-55, 0x1.c199bdd85529cp+0 },
-      { 0x1.2884dff483cacp-54, 0x1.c67f12e57d14bp+0 },
-      { 0x1.503cbd1e949dcp-56, 0x1.cb720dcef9069p+0 },
-      { -0x1.cbc3743797a9cp-54, 0x1.d072d4a07897cp+0 },
-      { 0x1.2ed02d75b3706p-55, 0x1.d5818dcfba487p+0 },
-      { 0x1.c2300696db532p-54, 0x1.da9e603db3285p+0 },
-      { -0x1.1a5cd4f184b5cp-54, 0x1.dfc97337b9b5fp+0 },
-      { 0x1.39e8980a9cc9p-55, 0x1.e502ee78b3ff6p+0 },
-      { -0x1.e9c23179c2894p-54, 0x1.ea4afa2a490dap+0 },
-      { 0x1.dc7f486a4b6bp-54, 0x1.efa1bee615a27p+0 },
-      { 0x1.9d3e12dd8a18ap-54, 0x1.f50765b6e454p+0 },
-      { 0x1.74853f3a5931ep-55, 0x1.fa7c1819e90d8p+0 }
-    };
-  static const double t1[][2] =
-    {
-      { 0x0p+0, 0x1p+0 },
-      { 0x1.ae8e38c59c72ap-54, 0x1.000b175effdc7p+0 },
-      { -0x1.7b5d0d58ea8f4p-58, 0x1.00162f3904052p+0 },
-      { 0x1.4115cb6b16a8ep-54, 0x1.0021478e11ce6p+0 },
-      { -0x1.d7c96f201bb2ep-55, 0x1.002c605e2e8cfp+0 },
-      { 0x1.84711d4c35eap-54, 0x1.003779a95f959p+0 },
-      { -0x1.0484245243778p-55, 0x1.0042936faa3d8p+0 },
-      { -0x1.4b237da2025fap-54, 0x1.004dadb113dap+0 },
-      { -0x1.5e00e62d6b30ep-56, 0x1.0058c86da1c0ap+0 },
-      { 0x1.a1d6cedbb948p-54, 0x1.0063e3a559473p+0 },
-      { -0x1.4acf197a00142p-54, 0x1.006eff583fc3dp+0 },
-      { -0x1.eaf2ea42391a6p-57, 0x1.007a1b865a8cap+0 },
-      { 0x1.da93f90835f76p-56, 0x1.0085382faef83p+0 },
-      { -0x1.6a79084ab093cp-55, 0x1.00905554425d4p+0 },
-      { 0x1.86364f8fbe8f8p-54, 0x1.009b72f41a12bp+0 },
-      { -0x1.82e8e14e3110ep-55, 0x1.00a6910f3b6fdp+0 },
-      { -0x1.4f6b2a7609f72p-55, 0x1.00b1afa5abcbfp+0 },
-      { -0x1.e1a258ea8f71ap-56, 0x1.00bcceb7707ecp+0 },
-      { 0x1.4362ca5bc26f2p-56, 0x1.00c7ee448ee02p+0 },
-      { 0x1.095a56c919d02p-54, 0x1.00d30e4d0c483p+0 },
-      { -0x1.406ac4e81a646p-57, 0x1.00de2ed0ee0f5p+0 },
-      { 0x1.b5a6902767e08p-54, 0x1.00e94fd0398ep+0 },
-      { -0x1.91b206085932p-54, 0x1.00f4714af41d3p+0 },
-      { 0x1.427068ab22306p-55, 0x1.00ff93412315cp+0 },
-      { 0x1.c1d0660524e08p-54, 0x1.010ab5b2cbd11p+0 },
-      { -0x1.e7bdfb3204be8p-54, 0x1.0115d89ff3a8bp+0 },
-      { 0x1.843aa8b9cbbc6p-55, 0x1.0120fc089ff63p+0 },
-      { -0x1.34104ee7edae8p-56, 0x1.012c1fecd613bp+0 },
-      { -0x1.2b6aeb6176892p-56, 0x1.0137444c9b5b5p+0 },
-      { 0x1.a8cd33b8a1bb2p-56, 0x1.01426927f5278p+0 },
-      { 0x1.2edc08e5da99ap-56, 0x1.014d8e7ee8d2fp+0 },
-      { 0x1.57ba2dc7e0c72p-55, 0x1.0158b4517bb88p+0 },
-      { 0x1.b61299ab8cdb8p-54, 0x1.0163da9fb3335p+0 },
-      { -0x1.90565902c5f44p-54, 0x1.016f0169949edp+0 },
-      { 0x1.70fc41c5c2d54p-55, 0x1.017a28af25567p+0 },
-      { 0x1.4b9a6e145d76cp-54, 0x1.018550706ab62p+0 },
-      { -0x1.008eff5142bfap-56, 0x1.019078ad6a19fp+0 },
-      { -0x1.77669f033c7dep-54, 0x1.019ba16628de2p+0 },
-      { -0x1.09bb78eeead0ap-54, 0x1.01a6ca9aac5f3p+0 },
-      { 0x1.371231477ece6p-54, 0x1.01b1f44af9f9ep+0 },
-      { 0x1.5e7626621eb5ap-56, 0x1.01bd1e77170b4p+0 },
-      { -0x1.bc72b100828a4p-54, 0x1.01c8491f08f08p+0 },
-      { -0x1.ce39cbbab8bbep-57, 0x1.01d37442d507p+0 },
-      { 0x1.16996709da2e2p-55, 0x1.01de9fe280ac8p+0 },
-      { -0x1.c11f5239bf536p-55, 0x1.01e9cbfe113efp+0 },
-      { 0x1.e1d4eb5edc6b4p-55, 0x1.01f4f8958c1c6p+0 },
-      { -0x1.afb99946ee3fp-54, 0x1.020025a8f6a35p+0 },
-      { -0x1.8f06d8a148a32p-54, 0x1.020b533856324p+0 },
-      { -0x1.2bf310fc54eb6p-55, 0x1.02168143b0281p+0 },
-      { -0x1.c95a035eb4176p-54, 0x1.0221afcb09e3ep+0 },
-      { -0x1.491793e46834cp-54, 0x1.022cdece68c4fp+0 },
-      { -0x1.3e8d0d9c4909p-56, 0x1.02380e4dd22adp+0 },
-      { -0x1.314aa16278aa4p-54, 0x1.02433e494b755p+0 },
-      { 0x1.48daf888e965p-55, 0x1.024e6ec0da046p+0 },
-      { 0x1.56dc8046821f4p-55, 0x1.02599fb483385p+0 },
-      { 0x1.45b42356b9d46p-54, 0x1.0264d1244c719p+0 },
-      { -0x1.082ef51b61d7ep-56, 0x1.027003103b10ep+0 },
-      { 0x1.2106ed0920a34p-56, 0x1.027b357854772p+0 },
-      { -0x1.fd4cf26ea5d0ep-54, 0x1.0286685c9e059p+0 },
-      { -0x1.09f8775e78084p-54, 0x1.02919bbd1d1d8p+0 },
-      { 0x1.64cbba902ca28p-58, 0x1.029ccf99d720ap+0 },
-      { 0x1.4383ef231d206p-54, 0x1.02a803f2d170dp+0 },
-      { 0x1.4a47a505b3a46p-54, 0x1.02b338c811703p+0 },
-      { 0x1.e47120223468p-54, 0x1.02be6e199c811p+0 },
-  };
   double ax = fabs (x);
   uint64_t aix = asuint64 (ax);
   /* for |x| >= 0x1.30fc1931f09cap+4, tanh(x) rounds to +1 or -1 to nearest,
@@ -338,7 +167,7 @@ __tanh (double x)
   const double sp = asdouble ((1023 + ie) << MANTISSA_WIDTH);
   static const double ch[]
       = { 0x1p+1, 0x1p+1, 0x1.55555557e54ffp+0, 0x1.55555553a12f4p-1 };
-  double t0h = t0[i0][1], t1h = t1[i1][1], th = t0h * t1h, tl;
+  double t0h = T0[i0][1], t1h = T1[i1][1], th = t0h * t1h, tl;
   if (aix < UINT64_C(0x400d76c8b4395810))
     { // |x| ~< 3.683
       if (__glibc_unlikely (aix < UINT64_C(0x3fd0000000000000)))
@@ -376,7 +205,7 @@ __tanh (double x)
          return as_tanh_zero (x);
        }
 
-      double t0l = t0[i0][0], t1l = t1[i1][0];
+      double t0l = T0[i0][0], t1l = T1[i1][0];
       tl = t0h * t1l + t1h * t0l + fma (t0h, t1h, -th);
       th *= sp;
       tl *= sp;
@@ -418,7 +247,7 @@ __tanh (double x)
       if (lb == ub)
        return lb;
 
-      double t0l = t0[i0][0], t1l = t1[i1][0];
+      double t0l = T0[i0][0], t1l = T1[i1][0];
       tl = t0h * t1l + t1h * t0l + fma (t0h, t1h, -th);
       th *= sp;
       tl *= sp;