aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64/e_atan2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_atan2.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_atan2.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c
index 425da22719..a03ce3e4a6 100644
--- a/sysdeps/ieee754/dbl-64/e_atan2.c
+++ b/sysdeps/ieee754/dbl-64/e_atan2.c
@@ -41,6 +41,8 @@
#include "MathLib.h"
#include "uatan.tbl"
#include "atnat2.h"
+#include <float.h>
+#include <math.h>
#include <math_private.h>
#include <stap-probe.h>
@@ -202,10 +204,18 @@ __ieee754_atan2 (double y, double x)
{
if (x > 0)
{
+ double ret;
if ((z = ay / ax) < TWOM1022)
- return normalized (ax, ay, y, z);
+ ret = normalized (ax, ay, y, z);
else
- return signArctan2 (y, z);
+ ret = signArctan2 (y, z);
+ if (fabs (ret) < DBL_MIN)
+ {
+ double vret = ret ? ret : DBL_MIN;
+ double force_underflow = vret * vret;
+ math_force_eval (force_underflow);
+ }
+ return ret;
}
else
{