glibc/sysdeps/ieee754/ldbl-128ibm
Joseph Myers 4648909d56 Fix cosh spurious underflows from expm1 (bug 16354), inaccurate results near 0 (bug 17061).
This patch fixes bug 16354, spurious underflows from cosh when a tiny
argument is passed to expm1 and expm1 correctly underflows although
the final result of cosh should be 1.  As noted in that bug, some
cases are latent because of expm1 implementations not raising
underflow (bug 16353), but all the implementations are fixed
similarly.  They already contained checks for tiny arguments, but the
checks were too late to avoid underflow from expm1 (although they
would avoid underflow from subsequent squaring of the result of
expm1); they are moved before the expm1 calls.

The thresholds used for considering arguments tiny are not
particularly consistent in how they relate to the precision of the
floating-point format in question.  They are, however, all sufficient
to ensure that the round-to-nearest result of cosh is indeed 1 below
the threshold (although sometimes they are smaller than necessary).
But the previous logic did not return 1, but the previously computed 1
+ expm1(abs(x)) value.  And the thresholds in the ldbl-128 and
ldbl-128ibm code (0x1p-71L - I suspect 0x3f8b was intended in the code
instead of 0x3fb8 - and (roughly) 0x1p-55L) are not sufficient for
that value to be 1.  So by moving the test for tiny arguments, and
consequently returning 1 directly now the expm1 value hasn't been
computed by that point, this patch also fixes bug 17061, the (large
number of ulps) inaccuracy for small arguments in those
implementations.  Tests for that bug are duly added.

Tested x86_64 and x86 and ulps updated accordingly.  Also tested for
mips64 and powerpc32 to validate the ldbl-128 and ldbl-128ibm changes.

	[BZ #16354]
	[BZ #17061]
	* sysdeps/ieee754/dbl-64/e_cosh.c (__ieee754_cosh): Check for
	small arguments before calling __expm1.
	* sysdeps/ieee754/flt-32/e_coshf.c (__ieee754_coshf): Check for
	small arguments before calling __expm1f.
	* sysdeps/ieee754/ldbl-128/e_coshl.c (__ieee754_coshl): Check for
	small arguments before calling __expm1l.
	* sysdeps/ieee754/ldbl-128ibm/e_coshl.c (__ieee754_coshl):
	Likewise.
	* sysdeps/ieee754/ldbl-96/e_coshl.c (__ieee754_coshl): Likewise.
	* math/auto-libm-test-in: Add more cosh tests.  Do not allow
	spurious underflow for some cosh tests.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
2014-06-23 20:20:10 +00:00
..
e_acoshl.c Fix ldbl-128ibm acoshl inaccuracy (bug 16384). 2014-01-02 16:33:06 +00:00
e_acosl.c Avoid ordered comparisons of NaNs in ldbl-128ibm acosl and asinl. 2013-10-10 19:11:30 +00:00
e_asinl.c Avoid ordered comparisons of NaNs in ldbl-128ibm acosl and asinl. 2013-10-10 19:11:30 +00:00
e_atan2l.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
e_atanhl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
e_coshl.c Fix cosh spurious underflows from expm1 (bug 16354), inaccurate results near 0 (bug 17061). 2014-06-23 20:20:10 +00:00
e_exp10l.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_expl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_fmodl.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
e_gammal_r.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_hypotl.c PowerPC floating point little-endian [4 of 15] 2013-10-04 10:32:48 +09:30
e_ilogbl.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
e_j0l.c 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
e_j1l.c 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
e_jnl.c Fix Bessel function error handling (bug 6807, bug 15901). 2013-12-04 14:39:37 +00:00
e_lgammal_r.c 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
e_log2l.c Fix log2 (1) in round-downward mode (bug 17042). 2014-06-10 12:07:15 +00:00
e_log10l.c Fix log10 (1) in round-downward mode (bug 16977). 2014-05-23 12:07:50 +00:00
e_logl.c Fix ldbl-128ibm logl inaccuracy (bug 16386). 2014-01-02 16:35:46 +00:00
e_powl.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
e_rem_pio2l.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
e_remainderl.c PowerPC floating point little-endian [4 of 15] 2013-10-04 10:32:48 +09:30
e_sinhl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
e_sqrtl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
gamma_productl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
ieee754.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
k_cosl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
k_sincosl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
k_sinl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
k_tanl.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
ldbl2mpn.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Makefile 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
math_ldbl.h Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
mpn2ldbl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
printf_fphex.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_asinhl.c Fix ldbl-128ibm asinhl inaccuracy (bug 16385). 2014-01-02 16:34:24 +00:00
s_atanl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_cbrtl.c 2006-01-27 Dwayne Grant McConnell <decimal@us.ibm.com> 2006-01-28 00:15:15 +00:00
s_ceill.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_copysignl.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_cosl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_cprojl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_ctanhl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_ctanl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_erfl.c Fix erf underflow handling near 0 (bug 16516). 2014-05-14 12:34:03 +00:00
s_expm1l.c Fix ldbl-128ibm expm1l on large arguments (bug 16408). 2014-01-08 13:32:39 +00:00
s_fabsl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_finitel.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_floorl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_fmal.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_fpclassifyl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_frexpl.c Correct IBM long double frexpl. 2014-04-16 19:33:32 +09:30
s_isinf_nsl.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
s_isinfl.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
s_isnanl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_issignalingl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_llrintl.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_llroundl.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_log1pl.c Fix log1pl (LDBL_MAX) in FE_UPWARD mode (bug 16564). 2014-05-14 12:38:56 +00:00
s_logbl.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_lrintl.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_lroundl.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_modfl.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
s_nearbyintl.c PowerPC: Fix nearbyintl failure for few inputs 2014-06-17 08:46:25 -05:00
s_nextafterl.c Correct IBM long double nextafterl. 2014-04-02 13:46:19 +10:30
s_nexttoward.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
s_nexttowardf.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
s_remquol.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_rintl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_roundl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_scalblnl.c [BZ #6803] Set errno for scalbln, scalbn 2014-06-20 07:48:20 +05:30
s_scalbnl.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
s_signbitl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_sincosl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
s_sinl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_tanhl.c PowerPC floating point little-endian [3 of 15] 2013-10-04 10:32:36 +09:30
s_tanl.c PowerPC floating point little-endian [2 of 15] 2013-10-04 10:32:19 +09:30
s_truncl.c PowerPC: remove wrong truncl implementation for PowerPC64 2014-01-08 08:14:48 -06:00
strtold_l.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
t_sincosl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
w_expl.c BZ#13889: expl (709.75) wrongly overflows for ldbl-128ibm 2013-03-22 12:39:10 -03:00
w_scalblnl.c [BZ #6803] Set errno for scalbln, scalbn 2014-06-20 07:48:20 +05:30
x2y2m1l.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00