aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-11-14 11:07:11 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-12-18 17:24:43 -0300
commited608a40e2903351c64a3cea51ce8bd7c62996ef (patch)
treee4e517e967698aadb2ff89fef5cde47bbf70761c
parent5fb4b566efd7785ce6fc75d16e369b6918549620 (diff)
downloadglibc-ed608a40e2903351c64a3cea51ce8bd7c62996ef.zip
glibc-ed608a40e2903351c64a3cea51ce8bd7c62996ef.tar.gz
glibc-ed608a40e2903351c64a3cea51ce8bd7c62996ef.tar.bz2
math: Use asinhf from CORE-MATH
The CORE-MATH implementation is correctly rounded (for any rounding mode) and shows slight better performance to the generic asinhf. The code was adapted to glibc style and to use the definition of math_config.h (to handle errno, overflow, and underflow). Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1, gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1): Latency master patched improvement x86_64 64.5128 56.9717 11.69% x86_64v2 63.3065 57.2666 9.54% x86_64v3 62.8719 51.4170 18.22% i686 189.1630 137.635 27.24% aarch64 (Neoverse) 25.3551 20.5757 18.85% power10 17.9712 13.3302 25.82% reciprocal-throughput master patched improvement x86_64 20.0844 15.4731 22.96% x86_64v2 19.2919 15.4000 20.17% x86_64v3 18.7226 11.9009 36.44% i686 103.7670 80.2681 22.65% aarch64 (Neoverse) 12.5005 8.68969 30.49% power10 7.2220 5.03617 30.27% Signed-off-by: Alexei Sibidanov <sibid@uvic.ca> Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr> Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>: Reviewed-by: DJ Delorie <dj@redhat.com>
-rw-r--r--SHARED-FILES4
-rw-r--r--sysdeps/aarch64/libm-test-ulps4
-rw-r--r--sysdeps/alpha/fpu/libm-test-ulps4
-rw-r--r--sysdeps/arc/fpu/libm-test-ulps4
-rw-r--r--sysdeps/arc/nofpu/libm-test-ulps1
-rw-r--r--sysdeps/arm/libm-test-ulps4
-rw-r--r--sysdeps/csky/fpu/libm-test-ulps4
-rw-r--r--sysdeps/csky/nofpu/libm-test-ulps4
-rw-r--r--sysdeps/hppa/fpu/libm-test-ulps4
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps3
-rw-r--r--sysdeps/i386/fpu/s_asinhf.S139
-rw-r--r--sysdeps/i386/i686/fpu/multiarch/libm-test-ulps3
-rw-r--r--sysdeps/ieee754/flt-32/s_asinhf.c221
-rw-r--r--sysdeps/loongarch/lp64/libm-test-ulps4
-rw-r--r--sysdeps/m68k/m680x0/fpu/libm-test-ulps4
-rw-r--r--sysdeps/microblaze/libm-test-ulps1
-rw-r--r--sysdeps/mips/mips32/libm-test-ulps4
-rw-r--r--sysdeps/mips/mips64/libm-test-ulps4
-rw-r--r--sysdeps/or1k/fpu/libm-test-ulps4
-rw-r--r--sysdeps/or1k/nofpu/libm-test-ulps4
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps4
-rw-r--r--sysdeps/powerpc/nofpu/libm-test-ulps4
-rw-r--r--sysdeps/riscv/nofpu/libm-test-ulps4
-rw-r--r--sysdeps/riscv/rvd/libm-test-ulps4
-rw-r--r--sysdeps/s390/fpu/libm-test-ulps4
-rw-r--r--sysdeps/sh/libm-test-ulps2
-rw-r--r--sysdeps/sparc/fpu/libm-test-ulps4
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps4
28 files changed, 184 insertions, 270 deletions
diff --git a/SHARED-FILES b/SHARED-FILES
index 6a6ff76..18b3244 100644
--- a/SHARED-FILES
+++ b/SHARED-FILES
@@ -306,3 +306,7 @@ sysdeps/ieee754/flt-32/e_asinf.c:
(src/binary32/asin/asinf.c in CORE-MATH)
- The code was adapted to use glibc code style and internal
functions to handle errno, overflow, and underflow.
+sysdeps/ieee754/flt-32/s_asinhf.c:
+ (src/binary32/asinh/asinhf.c in CORE-MATH)
+ - The code was adapted to use glibc code style and internal
+ functions to handle errno, overflow, and underflow.
diff --git a/sysdeps/aarch64/libm-test-ulps b/sysdeps/aarch64/libm-test-ulps
index da054b6..44493b3 100644
--- a/sysdeps/aarch64/libm-test-ulps
+++ b/sysdeps/aarch64/libm-test-ulps
@@ -95,7 +95,6 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 4
Function: "asinh_advsimd":
@@ -104,7 +103,6 @@ float: 2
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 4
Function: "asinh_sve":
@@ -113,12 +111,10 @@ float: 2
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 4
Function: "asinpi":
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index cda6ece..7082999 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -51,22 +51,18 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 4
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 4
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 4
Function: "atan":
diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
index 3c08593..1c34bd3 100644
--- a/sysdeps/arc/fpu/libm-test-ulps
+++ b/sysdeps/arc/fpu/libm-test-ulps
@@ -39,19 +39,15 @@ double: 2
Function: "asinh":
double: 3
-float: 2
Function: "asinh_downward":
double: 3
-float: 3
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "asinh_upward":
double: 3
-float: 3
Function: "atan":
double: 1
diff --git a/sysdeps/arc/nofpu/libm-test-ulps b/sysdeps/arc/nofpu/libm-test-ulps
index c3548a9..58fc499 100644
--- a/sysdeps/arc/nofpu/libm-test-ulps
+++ b/sysdeps/arc/nofpu/libm-test-ulps
@@ -12,7 +12,6 @@ double: 1
Function: "asinh":
double: 2
-float: 2
Function: "atan":
double: 1
diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
index 8e55b23..60f483e 100644
--- a/sysdeps/arm/libm-test-ulps
+++ b/sysdeps/arm/libm-test-ulps
@@ -55,19 +55,15 @@ double: 2
Function: "asinh":
double: 2
-float: 2
Function: "asinh_downward":
double: 3
-float: 3
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "asinh_upward":
double: 3
-float: 3
Function: "asinpi":
double: 1
diff --git a/sysdeps/csky/fpu/libm-test-ulps b/sysdeps/csky/fpu/libm-test-ulps
index b04ed2a..2b7b5cf 100644
--- a/sysdeps/csky/fpu/libm-test-ulps
+++ b/sysdeps/csky/fpu/libm-test-ulps
@@ -37,19 +37,15 @@ double: 1
Function: "asinh":
double: 2
-float: 2
Function: "asinh_downward":
double: 3
-float: 3
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "asinh_upward":
double: 3
-float: 3
Function: "atan":
float: 1
diff --git a/sysdeps/csky/nofpu/libm-test-ulps b/sysdeps/csky/nofpu/libm-test-ulps
index 612bd19..0eb62de 100644
--- a/sysdeps/csky/nofpu/libm-test-ulps
+++ b/sysdeps/csky/nofpu/libm-test-ulps
@@ -37,19 +37,15 @@ double: 1
Function: "asinh":
double: 2
-float: 2
Function: "asinh_downward":
double: 3
-float: 3
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "asinh_upward":
double: 3
-float: 3
Function: "atan":
float: 1
diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
index bb7e30f..f48a12f 100644
--- a/sysdeps/hppa/fpu/libm-test-ulps
+++ b/sysdeps/hppa/fpu/libm-test-ulps
@@ -55,19 +55,15 @@ double: 2
Function: "asinh":
double: 2
-float: 2
Function: "asinh_downward":
double: 3
-float: 3
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "asinh_upward":
double: 3
-float: 3
Function: "asinpi":
double: 1
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 11606b9..669ecbe 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -90,19 +90,16 @@ ldouble: 3
Function: "asinh_downward":
double: 1
-float: 1
float128: 4
ldouble: 5
Function: "asinh_towardzero":
double: 1
-float: 1
float128: 2
ldouble: 4
Function: "asinh_upward":
double: 1
-float: 1
float128: 4
ldouble: 5
diff --git a/sysdeps/i386/fpu/s_asinhf.S b/sysdeps/i386/fpu/s_asinhf.S
deleted file mode 100644
index fe52e20..0000000
--- a/sysdeps/i386/fpu/s_asinhf.S
+++ /dev/null
@@ -1,139 +0,0 @@
-/* ix87 specific implementation of arcsinh.
- Copyright (C) 1996-2024 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#include <machine/asm.h>
-#include <libm-alias-float.h>
-
- .section .rodata
-
- .align ALIGNARG(4)
- .type huge,@object
-huge: .double 1e+36
- ASM_SIZE_DIRECTIVE(huge)
- .type one,@object
-one: .double 1.0
- ASM_SIZE_DIRECTIVE(one)
- .type limit,@object
-limit: .double 0.29
- ASM_SIZE_DIRECTIVE(limit)
-
-#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
-#else
-#define MO(op) op
-#endif
-
- .text
-ENTRY(__asinhf)
- movl 4(%esp), %ecx
- movl $0x7fffffff, %eax
- andl %ecx, %eax
- andl $0x80000000, %ecx
- movl %eax, %edx
- orl $0x807fffff, %edx
- incl %edx
- jz 7f // x in ħInf or NaN
- xorl %ecx, 4(%esp)
- flds 4(%esp) // |x|
- cmpl $0x38000000, %eax
- jb 2f // |x| < 2^-14
- fldln2 // log(2) : |x|
- cmpl $0x47000000, %eax
- fxch // |x| : log(2)
- ja 3f // |x| > 2^14
-#ifdef PIC
- LOAD_PIC_REG (dx)
-#endif
- cmpl $0x40000000, %eax
- ja 5f // |x| > 2
-
- // 2^-14 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2)))
- fld %st // |x| : |x| : log(2)
- fmul %st(1) // |x|^2 : |x| : log(2)
- fld %st // |x|^2 : |x|^2 : |x| : log(2)
- faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2)
- fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
- faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2)
- fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2)
- faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2)
- fcoml MO(limit)
- fnstsw
- sahf
- ja 6f
- fyl2xp1
- jecxz 4f
- fchs
-4: ret
-
-7: flds 4(%esp)
- ret
-
-6: faddl MO(one)
- fyl2x
- jecxz 4f
- fchs
-4: ret
-
- // |x| < 2^-14 => y = x (inexact iff |x| != 0.0)
- .align ALIGNARG(4)
-2:
-#ifdef PIC
- LOAD_PIC_REG (dx)
-#endif
- jecxz 4f
- fchs // x
-4: fld %st // x : x
- faddl MO(huge) // huge+x : x
- fstp %st(0) // x
- cmpl $0x00800000, %eax
- jae 8f
- subl $4, %esp
- cfi_adjust_cfa_offset (4)
- fld %st(0)
- fmul %st(0)
- fstps (%esp)
- addl $4, %esp
- cfi_adjust_cfa_offset (-4)
-8: ret
-
- // |x| > 2^14 => y = sign(x) * (log(|x|) + log(2))
- .align ALIGNARG(4)
-3: fyl2x // log(|x|)
- fldln2 // log(2) : log(|x|)
- faddp // log(|x|)+log(2)
- jecxz 4f
- fchs
-4: ret
-
- // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1)))
- .align ALIGNARG(4)
-5: fld %st // |x| : |x| : log(2)
- fadd %st, %st(1) // |x| : 2*|x| : log(2)
- fld %st // |x| : |x| : 2*|x| : log(2)
- fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2)
- faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2)
- fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2)
- faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2)
- fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2)
- faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2)
- fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2)))
- jecxz 4f
- fchs
-4: ret
-END(__asinhf)
-libm_alias_float (__asinh, asinh)
diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
index f416f8d..e5bc05e 100644
--- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
+++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
@@ -90,19 +90,16 @@ ldouble: 3
Function: "asinh_downward":
double: 1
-float: 1
float128: 4
ldouble: 5
Function: "asinh_towardzero":
double: 1
-float: 1
float128: 2
ldouble: 4
Function: "asinh_upward":
double: 1
-float: 1
float128: 4
ldouble: 5
diff --git a/sysdeps/ieee754/flt-32/s_asinhf.c b/sysdeps/ieee754/flt-32/s_asinhf.c
index a94676f..93750f5 100644
--- a/sysdeps/ieee754/flt-32/s_asinhf.c
+++ b/sysdeps/ieee754/flt-32/s_asinhf.c
@@ -1,51 +1,190 @@
-/* s_asinhf.c -- float version of s_asinh.c.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include <float.h>
+/* Correctly-rounded inverse hyperbolic sine function for binary32 format.
+
+Copyright (c) 2023-2024 Alexei Sibidanov.
+
+The original version of this file was copied from the CORE-MATH
+project (file src/binary32/asinh/asinhf.c, revision e8774b3).
+
+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 <math.h>
-#include <math_private.h>
-#include <math-underflow.h>
+#include <stdint.h>
#include <libm-alias-float.h>
-
-static const float
-one = 1.0000000000e+00, /* 0x3F800000 */
-ln2 = 6.9314718246e-01, /* 0x3f317218 */
-huge= 1.0000000000e+30;
+#include "math_config.h"
float
-__asinhf(float x)
+__asinhf (float x)
{
- float w;
- int32_t hx,ix;
- GET_FLOAT_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(__builtin_expect(ix< 0x38000000, 0)) { /* |x|<2**-14 */
- math_check_force_underflow (x);
- if(huge+x>one) return x; /* return x inexact except 0 */
+ static const double ix[] =
+ {
+ 0x1p+0, 0x1.fc07f01fcp-1, 0x1.f81f81f82p-1, 0x1.f44659e4ap-1,
+ 0x1.f07c1f07cp-1, 0x1.ecc07b302p-1, 0x1.e9131abfp-1, 0x1.e573ac902p-1,
+ 0x1.e1e1e1e1ep-1, 0x1.de5d6e3f8p-1, 0x1.dae6076bap-1, 0x1.d77b654b8p-1,
+ 0x1.d41d41d42p-1, 0x1.d0cb58f6ep-1, 0x1.cd8568904p-1, 0x1.ca4b3055ep-1,
+ 0x1.c71c71c72p-1, 0x1.c3f8f01c4p-1, 0x1.c0e070382p-1, 0x1.bdd2b8994p-1,
+ 0x1.bacf914c2p-1, 0x1.b7d6c3ddap-1, 0x1.b4e81b4e8p-1, 0x1.b2036406cp-1,
+ 0x1.af286bca2p-1, 0x1.ac5701ac6p-1, 0x1.a98ef606ap-1, 0x1.a6d01a6dp-1,
+ 0x1.a41a41a42p-1, 0x1.a16d3f97ap-1, 0x1.9ec8e951p-1, 0x1.9c2d14ee4p-1,
+ 0x1.99999999ap-1, 0x1.970e4f80cp-1, 0x1.948b0fcd6p-1, 0x1.920fb49dp-1,
+ 0x1.8f9c18f9cp-1, 0x1.8d3018d3p-1, 0x1.8acb90f6cp-1, 0x1.886e5f0acp-1,
+ 0x1.861861862p-1, 0x1.83c977ab2p-1, 0x1.818181818p-1, 0x1.7f405fd02p-1,
+ 0x1.7d05f417ep-1, 0x1.7ad2208ep-1, 0x1.78a4c8178p-1, 0x1.767dce434p-1,
+ 0x1.745d1745ep-1, 0x1.724287f46p-1, 0x1.702e05c0cp-1, 0x1.6e1f76b44p-1,
+ 0x1.6c16c16c2p-1, 0x1.6a13cd154p-1, 0x1.681681682p-1, 0x1.661ec6a52p-1,
+ 0x1.642c8590cp-1, 0x1.623fa7702p-1, 0x1.605816058p-1, 0x1.5e75bb8dp-1,
+ 0x1.5c9882b94p-1, 0x1.5ac056b02p-1, 0x1.58ed23082p-1, 0x1.571ed3c5p-1,
+ 0x1.555555556p-1, 0x1.5390948f4p-1, 0x1.51d07eae2p-1, 0x1.501501502p-1,
+ 0x1.4e5e0a73p-1, 0x1.4cab88726p-1, 0x1.4afd6a052p-1, 0x1.49539e3b2p-1,
+ 0x1.47ae147aep-1, 0x1.460cbc7f6p-1, 0x1.446f86562p-1, 0x1.42d6625d6p-1,
+ 0x1.414141414p-1, 0x1.3fb013fbp-1, 0x1.3e22cbce4p-1, 0x1.3c995a47cp-1,
+ 0x1.3b13b13b2p-1, 0x1.3991c2c18p-1, 0x1.381381382p-1, 0x1.3698df3dep-1,
+ 0x1.3521cfb2cp-1, 0x1.33ae45b58p-1, 0x1.323e34a2cp-1, 0x1.30d19013p-1,
+ 0x1.2f684bda2p-1, 0x1.2e025c04cp-1, 0x1.2c9fb4d82p-1, 0x1.2b404ad02p-1,
+ 0x1.29e4129e4p-1, 0x1.288b01288p-1, 0x1.27350b882p-1, 0x1.25e22708p-1,
+ 0x1.24924924ap-1, 0x1.23456789ap-1, 0x1.21fb78122p-1, 0x1.20b470c68p-1,
+ 0x1.1f7047dc2p-1, 0x1.1e2ef3b4p-1, 0x1.1cf06ada2p-1, 0x1.1bb4a4046p-1,
+ 0x1.1a7b9611ap-1, 0x1.19453808cp-1, 0x1.181181182p-1, 0x1.16e068942p-1,
+ 0x1.15b1e5f76p-1, 0x1.1485f0e0ap-1, 0x1.135c81136p-1, 0x1.12358e75ep-1,
+ 0x1.111111112p-1, 0x1.0fef010fep-1, 0x1.0ecf56be6p-1, 0x1.0db20a89p-1,
+ 0x1.0c9714fbcp-1, 0x1.0b7e6ec26p-1, 0x1.0a6810a68p-1, 0x1.0953f3902p-1,
+ 0x1.084210842p-1, 0x1.073260a48p-1, 0x1.0624dd2f2p-1, 0x1.05197f7d8p-1,
+ 0x1.041041042p-1, 0x1.03091b52p-1, 0x1.020408102p-1, 0x1.01010101p-1,
+ 0x1p-1
+ };
+
+ static const double lix[] =
+ {
+ 0x0p+0, 0x1.fe02a6b146789p-8, 0x1.fc0a8b0fa03e4p-7,
+ 0x1.7b91b07de311bp-6, 0x1.f829b0e7c33p-6, 0x1.39e87b9fd7d6p-5,
+ 0x1.77458f63edcfcp-5, 0x1.b42dd7117b1bfp-5, 0x1.f0a30c01362a6p-5,
+ 0x1.16536eea7fae1p-4, 0x1.341d7961791d1p-4, 0x1.51b073f07983fp-4,
+ 0x1.6f0d28ae3eb4cp-4, 0x1.8c345d6383b21p-4, 0x1.a926d3a475563p-4,
+ 0x1.c5e548f63a743p-4, 0x1.e27076e28f2e6p-4, 0x1.fec9131dbaabbp-4,
+ 0x1.0d77e7ccf6e59p-3, 0x1.1b72ad52f87ap-3, 0x1.29552f81eb523p-3,
+ 0x1.371fc201f7f74p-3, 0x1.44d2b6ccbfd1ep-3, 0x1.526e5e3a41438p-3,
+ 0x1.5ff3070a613d4p-3, 0x1.6d60fe717221dp-3, 0x1.7ab890212b909p-3,
+ 0x1.87fa065214911p-3, 0x1.9525a9cf296b4p-3, 0x1.a23bc1fe42563p-3,
+ 0x1.af3c94e81bff3p-3, 0x1.bc2867430acd6p-3, 0x1.c8ff7c7989a22p-3,
+ 0x1.d5c216b535b91p-3, 0x1.e27076e2f92e6p-3, 0x1.ef0adcbe0d936p-3,
+ 0x1.fb9186d5ebe2bp-3, 0x1.0402594b51041p-2, 0x1.0a324e27370e3p-2,
+ 0x1.1058bf9ad7ad5p-2, 0x1.1675cabaa660ep-2, 0x1.1c898c16b91fbp-2,
+ 0x1.22941fbcfb966p-2, 0x1.2895a13dd2ea3p-2, 0x1.2e8e2bade7d31p-2,
+ 0x1.347dd9a9afd55p-2, 0x1.3a64c556b05eap-2, 0x1.40430868877e4p-2,
+ 0x1.4618bc219dec2p-2, 0x1.4be5f9579e0a1p-2, 0x1.51aad872c982dp-2,
+ 0x1.5767717432a6cp-2, 0x1.5d1bdbf5669cap-2, 0x1.62c82f2b83795p-2,
+ 0x1.686c81e9964afp-2, 0x1.6e08eaa2929e4p-2, 0x1.739d7f6b95007p-2,
+ 0x1.792a55fdb7fa2p-2, 0x1.7eaf83b82efc3p-2, 0x1.842d1da1ecb17p-2,
+ 0x1.89a3386be825bp-2, 0x1.8f11e87347ac7p-2, 0x1.947941c1f26fbp-2,
+ 0x1.99d958119208bp-2, 0x1.9f323ecbd984cp-2, 0x1.a484090e5eb0ap-2,
+ 0x1.a9cec9a9cf84ap-2, 0x1.af1293245606bp-2, 0x1.b44f77bc98f63p-2,
+ 0x1.b9858969218fbp-2, 0x1.beb4d9da96b7cp-2, 0x1.c3dd7a7d0354dp-2,
+ 0x1.c8ff7c79ada22p-2, 0x1.ce1af0b855bebp-2, 0x1.d32fe7e039bd5p-2,
+ 0x1.d83e72587673ep-2, 0x1.dd46a04c204a1p-2, 0x1.e24881a7cac26p-2,
+ 0x1.e744261d8a788p-2, 0x1.ec399d2457ccp-2, 0x1.f128f5fac86edp-2,
+ 0x1.f6123fa71c8acp-2, 0x1.faf588f76631fp-2, 0x1.ffd2e08580c98p-2,
+ 0x1.02552a5a4f0ffp-1, 0x1.04bdf9da8b6d2p-1, 0x1.0723e5c1b4f4p-1,
+ 0x1.0986f4f589521p-1, 0x1.0be72e423ca83p-1, 0x1.0e44985d0f48cp-1,
+ 0x1.109f39e2be497p-1, 0x1.12f71959283bcp-1, 0x1.154c3d2f4f5eap-1,
+ 0x1.179eabbd9c9a1p-1, 0x1.19ee6b466516fp-1, 0x1.1c3b81f723c25p-1,
+ 0x1.1e85f5e6ec0dp-1, 0x1.20cdcd193f76ep-1, 0x1.23130d7beb743p-1,
+ 0x1.2555bce9887cbp-1, 0x1.2795e1288211bp-1, 0x1.29d37fec2308bp-1,
+ 0x1.2c0e9ed45768cp-1, 0x1.2e47436e5ae68p-1, 0x1.307d7334ff0bep-1,
+ 0x1.32b1339134571p-1, 0x1.34e289d9b39d3p-1, 0x1.37117b5481bb6p-1,
+ 0x1.393e0d3549a1ap-1, 0x1.3b6844a017823p-1, 0x1.3d9026a70eefbp-1,
+ 0x1.3fb5b84cfeb42p-1, 0x1.41d8fe844b2aep-1, 0x1.43f9fe2fb9267p-1,
+ 0x1.4618bc21d86c2p-1, 0x1.48353d1e928dfp-1, 0x1.4a4f85db1debbp-1,
+ 0x1.4c679afcc323ap-1, 0x1.4e7d811b77bb1p-1, 0x1.50913cbff8c6bp-1,
+ 0x1.52a2d265be5abp-1, 0x1.54b2467998498p-1, 0x1.56bf9d5b34b99p-1,
+ 0x1.58cadb5cbe989p-1, 0x1.5ad404c33af2dp-1, 0x1.5cdb1dc6ad765p-1,
+ 0x1.5ee02a9241e75p-1, 0x1.60e32f447a8d9p-1, 0x1.62e42fefa39efp-1
+ };
+
+ uint32_t t = asuint (x);
+ t &= ~0u >> 1;
+ double xs = x;
+ if (__glibc_unlikely (t <= 0x3e815667u))
+ {
+ if (__glibc_unlikely (t <= 0x39ddb3d7u))
+ {
+ if (__glibc_unlikely (t == 0))
+ return x;
+ return fmaf (x, -0x1p-25f, x);
}
- if(__builtin_expect(ix>0x47000000, 0)) { /* |x| > 2**14 */
- if(ix>=0x7f800000) return x+x; /* x is inf or NaN */
- w = __ieee754_logf(fabsf(x))+ln2;
- } else {
- float xa = fabsf(x);
- if (ix>0x40000000) { /* 2**14 > |x| > 2.0 */
- w = __ieee754_logf(2.0f*xa+one/(sqrtf(xa*xa+one)+xa));
- } else { /* 2.0 > |x| > 2**-14 */
- float t = xa*xa;
- w =__log1pf(xa+t/(one+sqrtf(one+t)));
+ static const double c[] =
+ {
+ 0x1.5555555555553p-3, -0x1.3333333330e9dp-4, 0x1.6db6db67cb37ap-5,
+ -0x1.f1c71699375dp-6, 0x1.6e8a374c39ff9p-6, -0x1.1c1e98f9d01e1p-6,
+ 0x1.c277e96d84026p-7, -0x1.329ff5faf02abp-7
+ };
+ double x2 = xs * xs;
+ double x4 = x2 * x2;
+ double x8 = x4 * x4;
+ double f = x2 * (((c[0] + x2 * c[1]) + x4 * (c[2] + x2 * c[3]))
+ + x8 * ((c[4] + x2 * c[5]) + x4 * (c[6] + x2 * c[7])));
+ double r = xs - xs * f;
+ return r;
+ }
+ else
+ {
+ if (__glibc_unlikely (t >= 0x7f800000u))
+ return x + x; /* +-inf or nan */
+ double xd = fabs (xs);
+ double x2 = xd * xd;
+ uint64_t tp = asuint64 (xd + sqrt (x2 + 1));
+ uint64_t m = tp & (~UINT64_C(0) >> 12);
+ int j = (m + (UINT64_C(1) << (52 - 8))) >> (52 - 7);
+ int e = (tp >> 52) - 0x3ff;
+ double w = asdouble (m | UINT64_C(0x3ff) << 52);
+ double z = w * ix[j] - 1.0;
+ static const double c[] =
+ {
+ 0x1.0000000066947p+0, -0x1.00007f053d8cbp-1, 0x1.555280111d914p-2
+ };
+ double z2 = z * z;
+ double r = ((lix[128] * e + lix[j]) + z * c[0]) + z2 * (c[1] + z * c[2]);
+ if (__glibc_unlikely (((asuint64 (r) + 259000) & INT64_C(0xfffffff))
+ < 260000)) /* accurate path */
+ {
+ static const double cp[] =
+ {
+ 0x1p+0, -0x1p-1,
+ 0x1.55555555030bcp-2, -0x1.ffffffff2b4e5p-3,
+ 0x1.999b5076a42f2p-3, -0x1.55570c45a647dp-3
+ };
+ z2 = z * z;
+ double c0 = cp[0] + z * cp[1];
+ double c2 = cp[2] + z * cp[3];
+ double c4 = cp[4] + z * cp[5];
+ c0 += z2 * (c2 + z2 * c4);
+ const double ln2l = 0x1.7f7d1cf79abcap-20;
+ const double ln2h = 0x1.62e4p-1;
+ double Lh = ln2h * e;
+ double Ll = ln2l * e;
+ r = fma (z, c0, Ll + lix[j]) + Lh;
+ if (__glibc_unlikely ((asuint64 (r) & INT64_C(0xfffffff)) == 0))
+ {
+ double h = fma (z, c0, Ll + lix[j]) + (Lh - r);
+ r = r + 64 * h;
}
}
- return copysignf(w, x);
+ return copysign (r, xs);
+ }
}
libm_alias_float (__asinh, asinh)
diff --git a/sysdeps/loongarch/lp64/libm-test-ulps b/sysdeps/loongarch/lp64/libm-test-ulps
index 67beca8..b24bc58 100644
--- a/sysdeps/loongarch/lp64/libm-test-ulps
+++ b/sysdeps/loongarch/lp64/libm-test-ulps
@@ -51,22 +51,18 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 4
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 4
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 4
Function: "atan":
diff --git a/sysdeps/m68k/m680x0/fpu/libm-test-ulps b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
index 7301999..7b3e67e 100644
--- a/sysdeps/m68k/m680x0/fpu/libm-test-ulps
+++ b/sysdeps/m68k/m680x0/fpu/libm-test-ulps
@@ -34,22 +34,18 @@ float: 1
Function: "asinh":
double: 1
-float: 1
ldouble: 1
Function: "asinh_downward":
double: 2
-float: 2
ldouble: 2
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 2
-float: 2
ldouble: 3
Function: "atan2":
diff --git a/sysdeps/microblaze/libm-test-ulps b/sysdeps/microblaze/libm-test-ulps
index a0e8b5b..b7e73db 100644
--- a/sysdeps/microblaze/libm-test-ulps
+++ b/sysdeps/microblaze/libm-test-ulps
@@ -10,7 +10,6 @@ Function: "asin":
Function: "asinh":
double: 1
-float: 1
Function: "atan":
float: 1
diff --git a/sysdeps/mips/mips32/libm-test-ulps b/sysdeps/mips/mips32/libm-test-ulps
index 7eca3dc..ca4eac5 100644
--- a/sysdeps/mips/mips32/libm-test-ulps
+++ b/sysdeps/mips/mips32/libm-test-ulps
@@ -39,19 +39,15 @@ double: 2
Function: "asinh":
double: 2
-float: 2
Function: "asinh_downward":
double: 3
-float: 3
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "asinh_upward":
double: 3
-float: 3
Function: "atan":
double: 1
diff --git a/sysdeps/mips/mips64/libm-test-ulps b/sysdeps/mips/mips64/libm-test-ulps
index 4cabe88..30e8d46 100644
--- a/sysdeps/mips/mips64/libm-test-ulps
+++ b/sysdeps/mips/mips64/libm-test-ulps
@@ -51,22 +51,18 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 4
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 4
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 4
Function: "atan":
diff --git a/sysdeps/or1k/fpu/libm-test-ulps b/sysdeps/or1k/fpu/libm-test-ulps
index f95e138..dd972b3 100644
--- a/sysdeps/or1k/fpu/libm-test-ulps
+++ b/sysdeps/or1k/fpu/libm-test-ulps
@@ -39,19 +39,15 @@ double: 2
Function: "asinh":
double: 2
-float: 2
Function: "asinh_downward":
double: 3
-float: 3
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "asinh_upward":
double: 3
-float: 3
Function: "atan":
double: 1
diff --git a/sysdeps/or1k/nofpu/libm-test-ulps b/sysdeps/or1k/nofpu/libm-test-ulps
index 5ec5b1f..d5d1c8d 100644
--- a/sysdeps/or1k/nofpu/libm-test-ulps
+++ b/sysdeps/or1k/nofpu/libm-test-ulps
@@ -43,19 +43,15 @@ double: 1
Function: "asinh":
double: 2
-float: 2
Function: "asinh_downward":
double: 3
-float: 3
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "asinh_upward":
double: 3
-float: 3
Function: "asinpi":
double: 1
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index a11a589..edb6678 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -91,25 +91,21 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
float128: 4
ldouble: 2
Function: "asinh_downward":
double: 3
-float: 3
float128: 4
ldouble: 5
Function: "asinh_towardzero":
double: 2
-float: 2
float128: 2
ldouble: 5
Function: "asinh_upward":
double: 3
-float: 3
float128: 4
ldouble: 7
diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
index d03d25e..9394683 100644
--- a/sysdeps/powerpc/nofpu/libm-test-ulps
+++ b/sysdeps/powerpc/nofpu/libm-test-ulps
@@ -55,22 +55,18 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 2
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 5
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 5
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 7
Function: "atan":
diff --git a/sysdeps/riscv/nofpu/libm-test-ulps b/sysdeps/riscv/nofpu/libm-test-ulps
index edaa91a..7c89f79 100644
--- a/sysdeps/riscv/nofpu/libm-test-ulps
+++ b/sysdeps/riscv/nofpu/libm-test-ulps
@@ -51,22 +51,18 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 4
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 4
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 4
Function: "atan":
diff --git a/sysdeps/riscv/rvd/libm-test-ulps b/sysdeps/riscv/rvd/libm-test-ulps
index 4db2d02..e1c1a6a 100644
--- a/sysdeps/riscv/rvd/libm-test-ulps
+++ b/sysdeps/riscv/rvd/libm-test-ulps
@@ -51,22 +51,18 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 4
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 4
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 4
Function: "atan":
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index 22dfe60..038e3eb 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -51,22 +51,18 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 4
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 4
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 4
Function: "atan":
diff --git a/sysdeps/sh/libm-test-ulps b/sysdeps/sh/libm-test-ulps
index e225f78..4bd1ff1 100644
--- a/sysdeps/sh/libm-test-ulps
+++ b/sysdeps/sh/libm-test-ulps
@@ -19,11 +19,9 @@ double: 1
Function: "asinh":
double: 2
-float: 2
Function: "asinh_towardzero":
double: 2
-float: 2
Function: "atan":
float: 1
diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
index f24b64a..a4d678d 100644
--- a/sysdeps/sparc/fpu/libm-test-ulps
+++ b/sysdeps/sparc/fpu/libm-test-ulps
@@ -51,22 +51,18 @@ ldouble: 2
Function: "asinh":
double: 2
-float: 2
ldouble: 4
Function: "asinh_downward":
double: 3
-float: 3
ldouble: 4
Function: "asinh_towardzero":
double: 2
-float: 2
ldouble: 2
Function: "asinh_upward":
double: 3
-float: 3
ldouble: 4
Function: "atan":
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index ec2b362..23c40d0 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -147,25 +147,21 @@ float: 1
Function: "asinh":
double: 2
-float: 2
float128: 4
ldouble: 3
Function: "asinh_downward":
double: 3
-float: 3
float128: 4
ldouble: 5
Function: "asinh_towardzero":
double: 2
-float: 2
float128: 2
ldouble: 4
Function: "asinh_upward":
double: 3
-float: 3
float128: 4
ldouble: 5