summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ieee754/ldbl-128/s_atanl.c17
-rw-r--r--sysdeps/sparc/fpu/libm-test-ulps3
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps3
3 files changed, 23 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_atanl.c b/sysdeps/ieee754/ldbl-128/s_atanl.c
index 0138e792aa..adac0a79e7 100644
--- a/sysdeps/ieee754/ldbl-128/s_atanl.c
+++ b/sysdeps/ieee754/ldbl-128/s_atanl.c
@@ -167,6 +167,7 @@ static const long double
   q4 = 2.173623741810414221251136181221172551416E1L;
   /* q5 = 1.000000000000000000000000000000000000000E0 */
 
+static const long double huge = 1.0e4930L;
 
 long double
 __atanl (long double x)
@@ -197,6 +198,22 @@ __atanl (long double x)
 	return atantbl[83];
     }
 
+  if (k <= 0x3fc50000) /* |x| < 2**-58 */
+    {
+      /* Raise inexact. */
+      if (huge + x > 0.0)
+	return x;
+    }
+
+  if (k >= 0x40720000) /* |x| > 2**115 */
+    {
+      /* Saturate result to {-,+}pi/2 */
+      if (sign)
+	return -atantbl[83];
+      else
+	return atantbl[83];
+    }
+
   if (sign)
       x = -x;
 
diff --git a/sysdeps/sparc/fpu/libm-test-ulps b/sysdeps/sparc/fpu/libm-test-ulps
index ec0ad66204..432e01181a 100644
--- a/sysdeps/sparc/fpu/libm-test-ulps
+++ b/sysdeps/sparc/fpu/libm-test-ulps
@@ -102,6 +102,9 @@ float: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "atan2 (-max_value, -min_value) == -pi/2":
+float: 1
+ifloat: 1
 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
 float: 1
 ifloat: 1
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 4767be94db..f33dfed3df 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -162,6 +162,9 @@ ldouble: 1
 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
 float: 1
 ifloat: 1
+Test "atan2 (-max_value, -min_value) == -pi/2":
+float: 1
+ifloat: 1
 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
 float: 1
 ifloat: 1