diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_j1.c | 13 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_jn.c | 5 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/e_j1f.c | 10 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/e_jnf.c | 4 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/e_jnl.c | 5 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/e_jnl.c | 5 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/e_j1l.c | 13 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/e_jnl.c | 5 |
8 files changed, 55 insertions, 5 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_j1.c b/sysdeps/ieee754/dbl-64/e_j1.c index 653f33a..26ffdfe 100644 --- a/sysdeps/ieee754/dbl-64/e_j1.c +++ b/sysdeps/ieee754/dbl-64/e_j1.c @@ -59,6 +59,7 @@ */ #include <errno.h> +#include <float.h> #include <math.h> #include <math_private.h> @@ -124,8 +125,16 @@ __ieee754_j1 (double x) } if (__glibc_unlikely (ix < 0x3e400000)) /* |x|<2**-27 */ { - if (huge + x > one) - return 0.5 * x; /* inexact if x!=0 necessary */ + if (huge + x > one) /* inexact if x!=0 necessary */ + { + double ret = 0.5 * x; + if (fabs (ret) < DBL_MIN) + { + double force_underflow = ret * ret; + math_force_eval (force_underflow); + } + return ret; + } } z = x * x; r1 = z * R[0]; z2 = z * z; diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c index b0ddd5e..ccef2dc 100644 --- a/sysdeps/ieee754/dbl-64/e_jn.c +++ b/sysdeps/ieee754/dbl-64/e_jn.c @@ -246,6 +246,11 @@ __ieee754_jn (int n, double x) } if (ret == 0) ret = __copysign (DBL_MIN, ret) * DBL_MIN; + else if (fabs (ret) < DBL_MIN) + { + double force_underflow = ret * ret; + math_force_eval (force_underflow); + } return ret; } strong_alias (__ieee754_jn, __jn_finite) diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c index 7ffb57e..63de21f 100644 --- a/sysdeps/ieee754/flt-32/e_j1f.c +++ b/sysdeps/ieee754/flt-32/e_j1f.c @@ -14,6 +14,7 @@ */ #include <errno.h> +#include <float.h> #include <math.h> #include <math_private.h> @@ -69,7 +70,14 @@ __ieee754_j1f(float x) else return z; } if(__builtin_expect(ix<0x32000000, 0)) { /* |x|<2**-27 */ - if(huge+x>one) return (float)0.5*x;/* inexact if x!=0 necessary */ + if(huge+x>one) { /* inexact if x!=0 necessary */ + float ret = (float) 0.5 * x; + if (fabsf (ret) < FLT_MIN) { + float force_underflow = ret * ret; + math_force_eval (force_underflow); + } + return ret; + } } z = x*x; r = z*(r00+z*(r01+z*(r02+z*r03))); diff --git a/sysdeps/ieee754/flt-32/e_jnf.c b/sysdeps/ieee754/flt-32/e_jnf.c index ec5a81b..44a3761 100644 --- a/sysdeps/ieee754/flt-32/e_jnf.c +++ b/sysdeps/ieee754/flt-32/e_jnf.c @@ -170,6 +170,10 @@ __ieee754_jnf(int n, float x) } if (ret == 0) ret = __copysignf (FLT_MIN, ret) * FLT_MIN; + else if (fabsf (ret) < FLT_MIN) { + float force_underflow = ret * ret; + math_force_eval (force_underflow); + } return ret; } strong_alias (__ieee754_jnf, __jnf_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c index 14d65ff..a419994 100644 --- a/sysdeps/ieee754/ldbl-128/e_jnl.c +++ b/sysdeps/ieee754/ldbl-128/e_jnl.c @@ -297,6 +297,11 @@ __ieee754_jnl (int n, long double x) } if (ret == 0) ret = __copysignl (LDBL_MIN, ret) * LDBL_MIN; + else if (fabsl (ret) < LDBL_MIN) + { + long double force_underflow = ret * ret; + math_force_eval (force_underflow); + } return ret; } strong_alias (__ieee754_jnl, __jnl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c index 5d0a2b5..7594196 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c @@ -297,6 +297,11 @@ __ieee754_jnl (int n, long double x) } if (ret == 0) ret = __copysignl (LDBL_MIN, ret) * LDBL_MIN; + else if (fabsl (ret) < LDBL_MIN) + { + long double force_underflow = ret * ret; + math_force_eval (force_underflow); + } return ret; } strong_alias (__ieee754_jnl, __jnl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_j1l.c b/sysdeps/ieee754/ldbl-96/e_j1l.c index 1bd5499..46e28df 100644 --- a/sysdeps/ieee754/ldbl-96/e_j1l.c +++ b/sysdeps/ieee754/ldbl-96/e_j1l.c @@ -72,6 +72,7 @@ */ #include <errno.h> +#include <float.h> #include <math.h> #include <math_private.h> @@ -150,8 +151,16 @@ __ieee754_j1l (long double x) } if (__glibc_unlikely (ix < 0x3fde)) /* |x| < 2^-33 */ { - if (huge + x > one) - return 0.5 * x; /* inexact if x!=0 necessary */ + if (huge + x > one) /* inexact if x!=0 necessary */ + { + long double ret = 0.5 * x; + if (fabsl (ret) < LDBL_MIN) + { + long double force_underflow = ret * ret; + math_force_eval (force_underflow); + } + return ret; + } } z = x * x; r = z * (R[0] + z * (R[1]+ z * (R[2] + z * (R[3] + z * R[4])))); diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c index 49c9c42..2f3a452 100644 --- a/sysdeps/ieee754/ldbl-96/e_jnl.c +++ b/sysdeps/ieee754/ldbl-96/e_jnl.c @@ -290,6 +290,11 @@ __ieee754_jnl (int n, long double x) } if (ret == 0) ret = __copysignl (LDBL_MIN, ret) * LDBL_MIN; + else if (fabsl (ret) < LDBL_MIN) + { + long double force_underflow = ret * ret; + math_force_eval (force_underflow); + } return ret; } strong_alias (__ieee754_jnl, __jnl_finite) |