aboutsummaryrefslogtreecommitdiff
path: root/math/w_atan2.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/w_atan2.c')
-rw-r--r--math/w_atan2.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/math/w_atan2.c b/math/w_atan2.c
index efbf0b3..c56d7b6 100644
--- a/math/w_atan2.c
+++ b/math/w_atan2.c
@@ -20,6 +20,7 @@
* wrapper atan2(y,x)
*/
+#include <errno.h>
#include <math.h>
#include <math_private.h>
@@ -27,10 +28,15 @@
double
__atan2 (double y, double x)
{
+ double z;
+
if (__builtin_expect (x == 0.0 && y == 0.0, 0) && _LIB_VERSION == _SVID_)
return __kernel_standard (y, x, 3); /* atan2(+-0,+-0) */
- return __ieee754_atan2 (y, x);
+ z = __ieee754_atan2 (y, x);
+ if (__glibc_unlikely (z == 0.0 && y != 0.0 && __finite (x)))
+ __set_errno (ERANGE);
+ return z;
}
weak_alias (__atan2, atan2)
#ifdef NO_LONG_DOUBLE