From: Adhemerval Zanella Date: Wed, 19 Nov 2025 18:21:44 +0000 (-0300) Subject: math: Sync atanh from CORE-MATH X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92186652d8653993ca51e97b895baf7edc745794;p=thirdparty%2Fglibc.git math: Sync atanh from CORE-MATH The CORE-MATH commit 703d7487 fixes some issues for RNDZ: Failure: Test: atanh_towardzero (0x5.96200b978b69cp-4) Result: is: 3.6447730550366463e-01 0x1.753989ed16faap-2 should be: 3.6447730550366458e-01 0x1.753989ed16fa9p-2 difference: 5.5511151231257827e-17 0x1.0000000000000p-54 ulp : 1.0000 max.ulp : 0.0000 Maximal error of `atanh_towardzero' is : 1 ulp accepted: 0 ulp Checked on x86_64-linux-gnu, x86_64-linux-gnu-v3, aarch64-linux-gnu, and i686-linux-gnu. --- diff --git a/SHARED-FILES b/SHARED-FILES index 38fc87a79c..cced02d6a9 100644 --- a/SHARED-FILES +++ b/SHARED-FILES @@ -246,7 +246,7 @@ tzdata: core-math: # src/binary64/acosh/acosh.c, revision 6736002f sysdeps/ieee754/dbl-64/e_acosh.c - # src/binary64/atanh/atanh.c, revision c9abdf80 + # src/binary64/atanh/atanh.c, revision 703d7487 sysdeps/ieee754/dbl-64/e_atanh.c # src/binary64/tgamma/tgamma.c, revision 0f185e23 sysdeps/ieee754/dbl-64/e_gamma_r.c diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index 0e5b273970..0af70373fc 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -896,6 +896,7 @@ atanh -0x3.98eaf4p-4 atanh 0x2.c1085p-4 atanh 0x1p-500 atanh 0x1p-5000 +atanh 0x1.658802e5e2da7p-2 # the next value generates larger error bounds in libmvec/avx512 on x86_64 # (binary32) atanh 0x1.f80094p-8 diff --git a/math/auto-libm-test-out-atanh b/math/auto-libm-test-out-atanh index a5243264be..757d08952d 100644 --- a/math/auto-libm-test-out-atanh +++ b/math/auto-libm-test-out-atanh @@ -3112,6 +3112,75 @@ atanh 0x1p-5000 = atanh tonearest binary128 0x1p-5000 : 0x1p-5000 : inexact-ok = atanh towardzero binary128 0x1p-5000 : 0x1p-5000 : inexact-ok = atanh upward binary128 0x1p-5000 : 0x1.0000000000000000000000000001p-5000 : inexact-ok +atanh 0x1.658802e5e2da7p-2 += atanh downward binary32 0x5.96201p-4 : 0x5.d4e628p-4 : inexact-ok += atanh tonearest binary32 0x5.96201p-4 : 0x5.d4e63p-4 : inexact-ok += atanh towardzero binary32 0x5.96201p-4 : 0x5.d4e628p-4 : inexact-ok += atanh upward binary32 0x5.96201p-4 : 0x5.d4e63p-4 : inexact-ok += atanh downward binary64 0x5.96201p-4 : 0x5.d4e62cb97acp-4 : inexact-ok += atanh tonearest binary64 0x5.96201p-4 : 0x5.d4e62cb97acp-4 : inexact-ok += atanh towardzero binary64 0x5.96201p-4 : 0x5.d4e62cb97acp-4 : inexact-ok += atanh upward binary64 0x5.96201p-4 : 0x5.d4e62cb97ac04p-4 : inexact-ok += atanh downward intel96 0x5.96201p-4 : 0x5.d4e62cb97ac010f8p-4 : inexact-ok += atanh tonearest intel96 0x5.96201p-4 : 0x5.d4e62cb97ac011p-4 : inexact-ok += atanh towardzero intel96 0x5.96201p-4 : 0x5.d4e62cb97ac010f8p-4 : inexact-ok += atanh upward intel96 0x5.96201p-4 : 0x5.d4e62cb97ac011p-4 : inexact-ok += atanh downward m68k96 0x5.96201p-4 : 0x5.d4e62cb97ac010f8p-4 : inexact-ok += atanh tonearest m68k96 0x5.96201p-4 : 0x5.d4e62cb97ac011p-4 : inexact-ok += atanh towardzero m68k96 0x5.96201p-4 : 0x5.d4e62cb97ac010f8p-4 : inexact-ok += atanh upward m68k96 0x5.96201p-4 : 0x5.d4e62cb97ac011p-4 : inexact-ok += atanh downward binary128 0x5.96201p-4 : 0x5.d4e62cb97ac010fda7013fad52dp-4 : inexact-ok += atanh tonearest binary128 0x5.96201p-4 : 0x5.d4e62cb97ac010fda7013fad52d4p-4 : inexact-ok += atanh towardzero binary128 0x5.96201p-4 : 0x5.d4e62cb97ac010fda7013fad52dp-4 : inexact-ok += atanh upward binary128 0x5.96201p-4 : 0x5.d4e62cb97ac010fda7013fad52d4p-4 : inexact-ok += atanh downward ibm128 0x5.96201p-4 : 0x5.d4e62cb97ac010fda7013fad52p-4 : inexact-ok += atanh tonearest ibm128 0x5.96201p-4 : 0x5.d4e62cb97ac010fda7013fad52p-4 : inexact-ok += atanh towardzero ibm128 0x5.96201p-4 : 0x5.d4e62cb97ac010fda7013fad52p-4 : inexact-ok += atanh upward ibm128 0x5.96201p-4 : 0x5.d4e62cb97ac010fda7013fad54p-4 : inexact-ok += atanh downward binary32 0x5.962008p-4 : 0x5.d4e62p-4 : inexact-ok += atanh tonearest binary32 0x5.962008p-4 : 0x5.d4e62p-4 : inexact-ok += atanh towardzero binary32 0x5.962008p-4 : 0x5.d4e62p-4 : inexact-ok += atanh upward binary32 0x5.962008p-4 : 0x5.d4e628p-4 : inexact-ok += atanh downward binary64 0x5.962008p-4 : 0x5.d4e6239d271fcp-4 : inexact-ok += atanh tonearest binary64 0x5.962008p-4 : 0x5.d4e6239d271fcp-4 : inexact-ok += atanh towardzero binary64 0x5.962008p-4 : 0x5.d4e6239d271fcp-4 : inexact-ok += atanh upward binary64 0x5.962008p-4 : 0x5.d4e6239d272p-4 : inexact-ok += atanh downward intel96 0x5.962008p-4 : 0x5.d4e6239d271fcc9p-4 : inexact-ok += atanh tonearest intel96 0x5.962008p-4 : 0x5.d4e6239d271fcc9p-4 : inexact-ok += atanh towardzero intel96 0x5.962008p-4 : 0x5.d4e6239d271fcc9p-4 : inexact-ok += atanh upward intel96 0x5.962008p-4 : 0x5.d4e6239d271fcc98p-4 : inexact-ok += atanh downward m68k96 0x5.962008p-4 : 0x5.d4e6239d271fcc9p-4 : inexact-ok += atanh tonearest m68k96 0x5.962008p-4 : 0x5.d4e6239d271fcc9p-4 : inexact-ok += atanh towardzero m68k96 0x5.962008p-4 : 0x5.d4e6239d271fcc9p-4 : inexact-ok += atanh upward m68k96 0x5.962008p-4 : 0x5.d4e6239d271fcc98p-4 : inexact-ok += atanh downward binary128 0x5.962008p-4 : 0x5.d4e6239d271fcc91b25d7d622d48p-4 : inexact-ok += atanh tonearest binary128 0x5.962008p-4 : 0x5.d4e6239d271fcc91b25d7d622d4cp-4 : inexact-ok += atanh towardzero binary128 0x5.962008p-4 : 0x5.d4e6239d271fcc91b25d7d622d48p-4 : inexact-ok += atanh upward binary128 0x5.962008p-4 : 0x5.d4e6239d271fcc91b25d7d622d4cp-4 : inexact-ok += atanh downward ibm128 0x5.962008p-4 : 0x5.d4e6239d271fcc91b25d7d622cp-4 : inexact-ok += atanh tonearest ibm128 0x5.962008p-4 : 0x5.d4e6239d271fcc91b25d7d622ep-4 : inexact-ok += atanh towardzero ibm128 0x5.962008p-4 : 0x5.d4e6239d271fcc91b25d7d622cp-4 : inexact-ok += atanh upward ibm128 0x5.962008p-4 : 0x5.d4e6239d271fcc91b25d7d622ep-4 : inexact-ok += atanh downward binary64 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea4p-4 : inexact-ok += atanh tonearest binary64 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea8p-4 : inexact-ok += atanh towardzero binary64 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea4p-4 : inexact-ok += atanh upward binary64 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea8p-4 : inexact-ok += atanh downward intel96 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7ff8p-4 : inexact-ok += atanh tonearest intel96 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea8p-4 : inexact-ok += atanh towardzero intel96 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7ff8p-4 : inexact-ok += atanh upward intel96 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea8p-4 : inexact-ok += atanh downward m68k96 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7ff8p-4 : inexact-ok += atanh tonearest m68k96 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea8p-4 : inexact-ok += atanh towardzero m68k96 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7ff8p-4 : inexact-ok += atanh upward m68k96 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea8p-4 : inexact-ok += atanh downward binary128 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7fffffe2483036fp-4 : inexact-ok += atanh tonearest binary128 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7fffffe2483036f4p-4 : inexact-ok += atanh towardzero binary128 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7fffffe2483036fp-4 : inexact-ok += atanh upward binary128 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7fffffe2483036f4p-4 : inexact-ok += atanh downward ibm128 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7fffffe2483036p-4 : inexact-ok += atanh tonearest ibm128 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7fffffe2483036p-4 : inexact-ok += atanh towardzero ibm128 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7fffffe2483036p-4 : inexact-ok += atanh upward ibm128 0x5.96200b978b69cp-4 : 0x5.d4e627b45bea7fffffe2483038p-4 : inexact-ok atanh 0x1.f80094p-8 = atanh downward binary32 0x1.f80094p-8 : 0x1.f8031ep-8 : inexact-ok = atanh tonearest binary32 0x1.f80094p-8 : 0x1.f8032p-8 : inexact-ok diff --git a/sysdeps/ieee754/dbl-64/e_atanh.c b/sysdeps/ieee754/dbl-64/e_atanh.c index 9ebc7bab84..68ef87818d 100644 --- a/sysdeps/ieee754/dbl-64/e_atanh.c +++ b/sysdeps/ieee754/dbl-64/e_atanh.c @@ -3,7 +3,7 @@ Copyright (c) 2023-2025 Alexei Sibidanov. The original version of this file was copied from the CORE-MATH -project (file src/binary64/atanh/atanh.c, revision 4da7f241). +project (file src/binary64/atanh/atanh.c, revision 703d7487). Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -147,7 +147,7 @@ __ieee754_atanh (double x) ll += f; lh *= copysign (1, x); ll *= copysign (1, x); - double eps = 31e-24 + dx2 * 0x1p-49; + double eps = 34e-24 + dx2 * 0x1p-49; double lb = lh + (ll - eps), ub = lh + (ll + eps); if (__glibc_likely (lb == ub)) return lb;