aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/dbl-64/e_atan2.c14
-rw-r--r--sysdeps/ieee754/dbl-64/s_atan.c11
-rw-r--r--sysdeps/ieee754/flt-32/s_atanf.c6
-rw-r--r--sysdeps/ieee754/ldbl-128/s_atanl.c7
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_atanl.c6
5 files changed, 41 insertions, 3 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c
index 425da22..a03ce3e 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 a482bad..7b598f1 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;
diff --git a/sysdeps/ieee754/flt-32/s_atanf.c b/sysdeps/ieee754/flt-32/s_atanf.c
index 02c5e46..1593918 100644
--- a/sysdeps/ieee754/flt-32/s_atanf.c
+++ b/sysdeps/ieee754/flt-32/s_atanf.c
@@ -17,6 +17,7 @@
static char rcsid[] = "$NetBSD: s_atanf.c,v 1.4 1995/05/10 20:46:47 jtc Exp $";
#endif
+#include <float.h>
#include <math.h>
#include <math_private.h>
@@ -66,6 +67,11 @@ float __atanf(float x)
else return -atanhi[3]-atanlo[3];
} if (ix < 0x3ee00000) { /* |x| < 0.4375 */
if (ix < 0x31000000) { /* |x| < 2^-29 */
+ if (fabsf (x) < FLT_MIN)
+ {
+ float force_underflow = x * x;
+ math_force_eval (force_underflow);
+ }
if(huge+x>one) return x; /* raise inexact */
}
id = -1;
diff --git a/sysdeps/ieee754/ldbl-128/s_atanl.c b/sysdeps/ieee754/ldbl-128/s_atanl.c
index dc5e7ef..1367b6b 100644
--- a/sysdeps/ieee754/ldbl-128/s_atanl.c
+++ b/sysdeps/ieee754/ldbl-128/s_atanl.c
@@ -59,6 +59,8 @@
<http://www.gnu.org/licenses/>. */
+#include <float.h>
+#include <math.h>
#include <math_private.h>
/* arctan(k/8), k = 0, ..., 82 */
@@ -200,6 +202,11 @@ __atanl (long double x)
if (k <= 0x3fc50000) /* |x| < 2**-58 */
{
+ if (fabsl (x) < LDBL_MIN)
+ {
+ long double force_underflow = x * x;
+ math_force_eval (force_underflow);
+ }
/* Raise inexact. */
if (huge + x > 0.0)
return x;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
index 41dde23..6ddf4b1 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
@@ -59,6 +59,7 @@
<http://www.gnu.org/licenses/>. */
+#include <float.h>
#include <math.h>
#include <math_private.h>
#include <math_ldbl_opt.h>
@@ -198,6 +199,11 @@ __atanl (long double x)
if (k <= 0x3c800000) /* |x| <= 2**-55. */
{
+ if (fabsl (x) < LDBL_MIN)
+ {
+ long double force_underflow = x * x;
+ math_force_eval (force_underflow);
+ }
/* Raise inexact. */
if (1e300L + x > 0.0)
return x;