summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/s_tanhl.c')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_tanhl.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
index c63e25345d..e6457a1c1c 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
@@ -29,15 +29,16 @@ static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $";
* 2**-57 < x <= 1 : tanh(x) := -----; t = expm1(-2x)
* t + 2
* 2
- * 1 <= x <= 22.0 : tanh(x) := 1- ----- ; t=expm1(2x)
+ * 1 <= x <= 40.0 : tanh(x) := 1- ----- ; t=expm1(2x)
* t + 2
- * 22.0 < x <= INF : tanh(x) := 1.
+ * 40.0 < x <= INF : tanh(x) := 1.
*
* Special cases:
* tanh(NaN) is NaN;
* only tanh(0)=0 is exact for finite argument.
*/
+#include <float.h>
#include <math.h>
#include <math_private.h>
#include <math_ldbl_opt.h>
@@ -61,12 +62,15 @@ long double __tanhl(long double x)
else return one/x-one; /* tanh(NaN) = NaN */
}
- /* |x| < 22 */
- if (ix < 0x4036000000000000LL) { /* |x|<22 */
+ /* |x| < 40 */
+ if (ix < 0x4044000000000000LL) { /* |x|<40 */
if (ix == 0)
return x; /* x == +-0 */
if (ix<0x3c60000000000000LL) /* |x|<2**-57 */
- return x*(one+x); /* tanh(small) = small */
+ {
+ math_check_force_underflow (x);
+ return x; /* tanh(small) = small */
+ }
if (ix>=0x3ff0000000000000LL) { /* |x|>=1 */
t = __expm1l(two*fabsl(x));
z = one - two/(t+two);
@@ -74,7 +78,7 @@ long double __tanhl(long double x)
t = __expm1l(-two*fabsl(x));
z= -t/(t+two);
}
- /* |x| > 22, return +-1 */
+ /* |x| > 40, return +-1 */
} else {
z = one - tiny; /* raised inexact flag */
}