about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/s_tanhf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_tanhf.c')
-rw-r--r--sysdeps/libm-ieee754/s_tanhf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/libm-ieee754/s_tanhf.c b/sysdeps/libm-ieee754/s_tanhf.c
index b989ef3565..2a0ca9f3df 100644
--- a/sysdeps/libm-ieee754/s_tanhf.c
+++ b/sysdeps/libm-ieee754/s_tanhf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -40,13 +40,15 @@ static float one=1.0, two=2.0, tiny = 1.0e-30;
 	ix = jx&0x7fffffff;
 
     /* x is INF or NaN */
-	if(ix>=0x7f800000) { 
+	if(ix>=0x7f800000) {
 	    if (jx>=0) return one/x+one;    /* tanh(+-inf)=+-1 */
 	    else       return one/x-one;    /* tanh(NaN) = NaN */
 	}
 
     /* |x| < 22 */
 	if (ix < 0x41b00000) {		/* |x|<22 */
+	    if (ix == 0)
+		return x;		/* x == +-0 */
 	    if (ix<0x24000000) 		/* |x|<2**-55 */
 		return x*(one+x);    	/* tanh(small) = small */
 	    if (ix>=0x3f800000) {	/* |x|>=1  */