@@ -157,13 +157,12 @@ atan2 -min -max
atan2 min_subnorm -max
atan2 -min_subnorm -max
# Bug 15319: underflow exception may be missing.
-# Bug 16349: errno setting may be missing.
atan2 1 max missing-underflow
atan2 -1 max missing-underflow
-atan2 min max missing-underflow missing-errno
-atan2 -min max missing-underflow missing-errno
-atan2 min_subnorm max missing-underflow missing-errno
-atan2 -min_subnorm max missing-underflow missing-errno
+atan2 min max missing-underflow
+atan2 -min max missing-underflow
+atan2 min_subnorm max missing-underflow
+atan2 -min_subnorm max missing-underflow
atanh 0
atanh -0
@@ -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
@@ -20,6 +20,7 @@
* wrapper atan2f(y,x)
*/
+#include <errno.h>
#include <math.h>
#include <math_private.h>
@@ -27,9 +28,14 @@
float
__atan2f (float y, float x)
{
+ float z;
+
if (__builtin_expect (x == 0.0f && y == 0.0f, 0) && _LIB_VERSION == _SVID_)
return __kernel_standard_f (y, x, 103); /* atan2(+-0,+-0) */
- return __ieee754_atan2f (y, x);
+ z = __ieee754_atan2f (y, x);
+ if (__glibc_unlikely (z == 0.0f && y != 0.0f && __finitef (x)))
+ __set_errno (ERANGE);
+ return z;
}
weak_alias (__atan2f, atan2f)
@@ -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)