about summary refs log tree commit diff
path: root/math/w_atan2l.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/w_atan2l.c')
-rw-r--r--math/w_atan2l.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/math/w_atan2l.c b/math/w_atan2l.c
index f1de1d14e9..d6498aef89 100644
--- a/math/w_atan2l.c
+++ b/math/w_atan2l.c
@@ -20,6 +20,7 @@
  * wrapper atan2l(y,x)
  */
 
+#include <errno.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -27,9 +28,14 @@
 long double
 __atan2l (long double y, long double x)
 {
+  long double z;
+
   if (__builtin_expect (x == 0.0L && y == 0.0L, 0) && _LIB_VERSION == _SVID_)
     return __kernel_standard_l (y, x, 203); /* atan2(+-0,+-0) */
 
-  return __ieee754_atan2l (y, x);
+  z = __ieee754_atan2l (y, x);
+  if (__glibc_unlikely (z == 0.0L && y != 0.0L && __finitel (x)))
+    __set_errno (ERANGE);
+  return z;
 }
 weak_alias (__atan2l, atan2l)