diff options
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_atan2.c | 14 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_atan.c | 11 |
2 files changed, 22 insertions, 3 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 { diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_atan.c index a482badc56..7b598f14a9 100644 --- a/sysdeps/ieee754/dbl-64/s_atan.c +++ b/sysdeps/ieee754/dbl-64/s_atan.c @@ -41,7 +41,9 @@ #include "MathLib.h" #include "uatan.tbl" #include "atnat.h" +#include <float.h> #include <math.h> +#include <math_private.h> #include <stap-probe.h> void __mpatan (mp_no *, mp_no *, int); /* see definition in mpatan.c */ @@ -85,7 +87,14 @@ atan (double x) if (u < B) { if (u < A) - return x; + { + if (u < DBL_MIN) + { + double force_underflow = x * x; + math_force_eval (force_underflow); + } + return x; + } else { /* A <= u < B */ v = x * x; |