diff options
Diffstat (limited to 'sysdeps/ieee754/flt-32/s_erff.c')
-rw-r--r-- | sysdeps/ieee754/flt-32/s_erff.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c index 7d17f426e9..7c09589648 100644 --- a/sysdeps/ieee754/flt-32/s_erff.c +++ b/sysdeps/ieee754/flt-32/s_erff.c @@ -17,6 +17,8 @@ static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $"; #endif +#include <errno.h> +#include <float.h> #include <math.h> #include <math_private.h> @@ -203,9 +205,22 @@ float __erfcf(float x) SET_FLOAT_WORD(z,ix&0xffffe000); r = __ieee754_expf(-z*z-(float)0.5625)* __ieee754_expf((z-x)*(z+x)+R/S); - if(hx>0) return r/x; else return two-r/x; + if(hx>0) { +#if FLT_EVAL_METHOD != 0 + volatile +#endif + float ret = r/x; + if (ret == 0) + __set_errno (ERANGE); + return ret; + } else + return two-r/x; } else { - if(hx>0) return tiny*tiny; else return two-tiny; + if(hx>0) { + __set_errno (ERANGE); + return tiny*tiny; + } else + return two-tiny; } } weak_alias (__erfcf, erfcf) |