summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64/s_erf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_erf.c')
-rw-r--r--sysdeps/ieee754/dbl-64/s_erf.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_erf.c b/sysdeps/ieee754/dbl-64/s_erf.c
index ea0a73424e..b4975a8af8 100644
--- a/sysdeps/ieee754/dbl-64/s_erf.c
+++ b/sysdeps/ieee754/dbl-64/s_erf.c
@@ -116,6 +116,7 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $";
#include <float.h>
#include <math.h>
#include <math_private.h>
+#include <fix-int-fp-convert-zero.h>
static const double
tiny = 1e-300,
@@ -213,11 +214,7 @@ __erf (double x)
{
/* Avoid spurious underflow. */
double ret = 0.0625 * (16.0 * x + (16.0 * efx) * x);
- if (fabs (ret) < DBL_MIN)
- {
- double force_underflow = ret * ret;
- math_force_eval (force_underflow);
- }
+ math_check_force_underflow (ret);
return ret;
}
return x + efx * x;
@@ -312,7 +309,10 @@ __erfc (double x)
ix = hx & 0x7fffffff;
if (ix >= 0x7ff00000) /* erfc(nan)=nan */
{ /* erfc(+-inf)=0,2 */
- return (double) (((u_int32_t) hx >> 31) << 1) + one / x;
+ double ret = (double) (((u_int32_t) hx >> 31) << 1) + one / x;
+ if (FIX_INT_FP_CONVERT_ZERO && ret == 0.0)
+ return 0.0;
+ return ret;
}
if (ix < 0x3feb0000) /* |x|<0.84375 */
@@ -402,10 +402,7 @@ __erfc (double x)
__ieee754_exp ((z - x) * (z + x) + R / S);
if (hx > 0)
{
-#if FLT_EVAL_METHOD != 0
- volatile
-#endif
- double ret = r / x;
+ double ret = math_narrow_eval (r / x);
if (ret == 0)
__set_errno (ERANGE);
return ret;