about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/s_tanh.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_tanh.c')
-rw-r--r--sysdeps/libm-ieee754/s_tanh.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/libm-ieee754/s_tanh.c b/sysdeps/libm-ieee754/s_tanh.c
index 208b459b35..944f96386f 100644
--- a/sysdeps/libm-ieee754/s_tanh.c
+++ b/sysdeps/libm-ieee754/s_tanh.c
@@ -55,10 +55,10 @@ static double one=1.0, two=2.0, tiny = 1.0e-300;
 #endif
 {
 	double t,z;
-	int32_t jx,ix;
+	int32_t jx,ix,lx;
 
     /* High word of |x|. */
-	GET_HIGH_WORD(jx,x);
+	EXTRACT_WORDS(jx,lx,x);
 	ix = jx&0x7fffffff;
 
     /* x is INF or NaN */
@@ -69,6 +69,8 @@ static double one=1.0, two=2.0, tiny = 1.0e-300;
 
     /* |x| < 22 */
 	if (ix < 0x40360000) {		/* |x|<22 */
+	    if ((ix | lx) == 0)
+		return x;		/* x == +-0 */
 	    if (ix<0x3c800000) 		/* |x|<2**-55 */
 		return x*(one+x);    	/* tanh(small) = small */
 	    if (ix>=0x3ff00000) {	/* |x|>=1  */