about summary refs log tree commit diff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-11-22 19:56:47 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-11-22 19:56:47 +0000
commit0a42601f272ea962b200d452a54e0ca374163f60 (patch)
tree79f2d88d56d8c44a291ac0e235ace15b8a3cfe6d /sysdeps/ieee754
parent79c9b9feb45d175d4a394edd9ecf89cde97890c4 (diff)
downloadglibc-0a42601f272ea962b200d452a54e0ca374163f60.tar.gz
glibc-0a42601f272ea962b200d452a54e0ca374163f60.tar.xz
glibc-0a42601f272ea962b200d452a54e0ca374163f60.zip
Fix ldbl-128ibm atanl spurious underflows (bug 14871).
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_atanl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
index 779209d3d7..2a36d16bb4 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
@@ -199,6 +199,22 @@ __atanl (long double x)
 	return atantbl[83];
     }
 
+  if (k <= 0x3c800000) /* |x| <= 2**-55.  */
+    {
+      /* Raise inexact.  */
+      if (1e300L + x > 0.0)
+	return x;
+    }
+
+  if (k >= 0x46c00000) /* |x| >= 2**109.  */
+    {
+      /* Saturate result to {-,+}pi/2.  */
+      if (sign)
+	return -atantbl[83];
+      else
+	return atantbl[83];
+    }
+
   if (sign)
       x = -x;