glibc/sysdeps/ieee754/dbl-64
Joseph Myers 0bf061d3e3 Fix erf underflow handling near 0 (bug 16516).
Bug 16516 reports spurious underflows from erf (for all floating-point
types), when the result is close to underflowing but does not actually
underflow.

erf (x) is about (2/sqrt(pi))*x for x close to 0, so there are
subnormal arguments for which it does not underflow.  The various
implementations do (x + efx*x) (for efx = 2/sqrt(pi) - 1), for greater
accuracy than if just using a single multiplication by an
approximation to 2/sqrt(pi) (effectively, this way there are a few
more bits in the approximation to 2/sqrt(pi)).  This can introduce
underflows when efx*x underflows even though the final result does
not, so a scaled calculation with 8*efx is done in these cases - but 8
is not a big enough scale factor to avoid all such underflows.  16 is
(any underflows with a scale factor of 16 would only occur when the
final result underflows), so this patch changes the code to use that
factor.  Rather than recomputing all the values of the efx8 variable,
it is removed, leaving it to the compiler's constant folding to
compute 16*efx.  As such scaling can also lose underflows when the
final scaling down happens to be exact, appropriate checks are added
to ensure underflow exceptions occur when required in such cases.

Tested x86_64 and x86; no ulps updates needed.  Also spot-checked for
powerpc32 and mips64 to verify the changes to the ldbl-128ibm and
ldbl-128 implementations.

	[BZ #16516]
	* sysdeps/ieee754/dbl-64/s_erf.c (efx8): Remove variable.
	(__erf): Scale by 16 instead of 8 in potentially underflowing
	case.  Ensure exception if result actually underflows.
	* sysdeps/ieee754/flt-32/s_erff.c (efx8): Remove variable.
	(__erff): Scale by 16 instead of 8 in potentially underflowing
	case.  Ensure exception if result actually underflows.
	* sysdeps/ieee754/ldbl-128/s_erfl.c: Include <float.h>.
	(efx8): Remove variable.
	(__erfl): Scale by 16 instead of 8 in potentially underflowing
	case.  Ensure exception if result actually underflows.
	* sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Include <float.h>.
	(efx8): Remove variable.
	(__erfl): Scale by 16 instead of 8 in potentially underflowing
	case.  Ensure exception if result actually underflows.
	* sysdeps/ieee754/ldbl-96/s_erfl.c: Include <float.h>.
	(efx8): Remove variable.
	(__erfl): Scale by 16 instead of 8 in potentially underflowing
	case.  Ensure exception if result actually underflows.
	* math/auto-libm-test-in: Add more tests of erf.
	* math/auto-libm-test-out: Regenerated.
2014-05-14 12:34:03 +00:00
..
wordsize-64 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
asincos.tbl Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
atnat2.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
atnat.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
branred.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
branred.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
dbl2mpn.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
dla.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
doasin.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
doasin.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
dosincos.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
dosincos.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_acos.c
e_acosh.c Format floating routines. 2013-10-17 16:03:24 +02:00
e_asin.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_atan2.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_atanh.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_cosh.c Format floating routines. 2013-10-17 16:03:24 +02:00
e_exp2.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_exp10.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_exp.c Fix implicit __isinf declarations in exp. 2014-03-24 22:00:32 +00:00
e_fmod.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_gamma_r.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_hypot.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_ilogb.c Format floating routines. 2013-10-17 16:03:24 +02:00
e_j0.c Format floating routines. 2013-10-17 16:03:24 +02:00
e_j1.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_jn.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_lgamma_r.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
e_log2.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_log10.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_log.c Fix log (1) in round-downward mode (bug 16731). 2014-03-21 18:13:58 +00:00
e_pow.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_rem_pio2.c Format floating routines. 2013-10-17 16:03:24 +02:00
e_remainder.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_sinh.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_sqrt.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
gamma_product.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
gamma_productf.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
halfulp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
k_cos.c
k_rem_pio2.c Format floating routines. 2013-10-17 16:03:24 +02:00
k_sin.c
k_tan.c Replace sysdeps/ieee754/dbl-64/k_tan.c with empty file 2012-02-26 16:10:46 +01:00
Makefile Compile e_sqrt.c with -ffp-contract=off. 2013-12-18 12:07:06 +00:00
MathLib.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpa-arch.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpa.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpa.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpatan2.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpatan.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpatan.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpexp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mplog.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpn2dbl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpsqrt.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mpsqrt.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mptan.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
mydefs.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
powtwo.tbl Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
root.tbl Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_asinh.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_atan.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_cbrt.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_ceil.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_copysign.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_cos.c
s_erf.c Fix erf underflow handling near 0 (bug 16516). 2014-05-14 12:34:03 +00:00
s_expm1.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_fabs.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_finite.c PowerPC: multiarch finite/finitef for PowerPC32 2013-12-06 05:47:03 -06:00
s_floor.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_fma.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_fmaf.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_fpclassify.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_frexp.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_isinf_ns.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_isinf.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_isnan.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_issignaling.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_llrint.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_llround.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_log1p.c [BZ #16823] Fix log1pl returning wrong infinity sign 2014-04-29 15:43:36 +02:00
s_logb.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_lrint.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_lround.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_modf.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_nearbyint.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_nexttoward.c
s_remquo.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_rint.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_round.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_scalbln.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_scalbn.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_signbit.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_sin.c Fix sign of input to bsloww1 (BZ #16623) 2014-02-27 21:12:09 +05:30
s_sincos.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_tan.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_tanh.c Format floating routines. 2013-10-17 16:03:24 +02:00
s_trunc.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sincos32.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sincos32.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sincostab.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
slowexp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
slowpow.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
t_exp2.h
t_exp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
uasncs.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
uatan.tbl Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
uexp.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
uexp.tbl Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
ulog.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
ulog.tbl Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
upow.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
upow.tbl Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
urem.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
uroot.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
usncs.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
utan.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
utan.tbl Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
w_exp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
x2y2m1.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
x2y2m1f.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00