glibc/sysdeps/ieee754/flt-32
Joseph Myers c8235dda72 Avoid excess range overflowing results from cosh, sinh, lgamma (bug 18980).
Various i386 libm functions return values with excess range and
precision; Wilco Dijkstra's patches to make isfinite etc. expand
inline cause this pre-existing issue to result in test failures (when
e.g. a result that overflows float but not long double gets counted as
overflowing for some purposes but not others).

This patch addresses those cases arising from functions defined in C,
adding a math_narrow_eval macro that forces values to memory to
eliminate excess precision if FLT_EVAL_METHOD indicates this is
needed, and is a no-op otherwise.  I'll convert existing uses of
volatile and asm for this purpose to use the new macro later, once
i386 has clean test results again (which requires fixes for .S files
as well).

Tested for x86_64 and x86.  Committed.

	[BZ #18980]
	* sysdeps/generic/math_private.h: Include <float.h>.
	(math_narrow_eval): New macro.
	[FLT_EVAL_METHOD != 0] (excess_precision): Likewise.
	* sysdeps/ieee754/dbl-64/e_cosh.c (__ieee754_cosh): Use
	math_narrow_eval on overflowing return value.
	* sysdeps/ieee754/dbl-64/e_lgamma_r.c (__ieee754_lgamma_r):
	Likewise.
	* sysdeps/ieee754/dbl-64/e_sinh.c (__ieee754_sinh): Likewise.
	* sysdeps/ieee754/flt-32/e_coshf.c (__ieee754_coshf): Likewise.
	* sysdeps/ieee754/flt-32/e_lgammaf_r.c (__ieee754_lgammaf_r):
	Likewise.
	* sysdeps/ieee754/flt-32/e_sinhf.c (__ieee754_sinhf): Likewise.
2015-09-18 20:00:48 +00:00
..
e_acosf.c Fix acosf underflow (bug 14153). 2012-05-25 11:07:07 +00:00
e_acoshf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
e_asinf.c Fix asin missing underflows (bug 16351). 2015-02-26 17:18:54 +00:00
e_atan2f.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
e_atanhf.c Fix atanhl missing underflows (bug 16352). 2015-05-15 22:07:57 +00:00
e_coshf.c Avoid excess range overflowing results from cosh, sinh, lgamma (bug 18980). 2015-09-18 20:00:48 +00:00
e_exp2f.c Since we now inline isinf, isnan and isfinite in math.h, replace uses of __isinf_ns(l/f) 2015-09-18 20:51:52 +01:00
e_expf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
e_fmodf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
e_gammaf_r.c Fix tgamma missing underflows (bug 18951). 2015-09-17 15:51:54 +00:00
e_hypotf.c Simplify hypotf infinity handling (bug 15918). 2015-09-15 17:24:23 +00:00
e_ilogbf.c Remove useless __ilogb*_finite aliases 2012-04-18 00:40:13 +02:00
e_j0f.c Avoid uninitialized warnings in Bessel functions. 2015-02-26 21:49:19 +00:00
e_j1f.c Fix j1, jn missing underflows (bug 16559). 2015-06-29 16:52:16 +00:00
e_jnf.c Fix j1, jn missing underflows (bug 16559). 2015-06-29 16:52:16 +00:00
e_lgammaf_r.c Avoid excess range overflowing results from cosh, sinh, lgamma (bug 18980). 2015-09-18 20:00:48 +00:00
e_log2f.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
e_log10f.c Fix several build failures with GCC6 due to unused static variables. 2015-09-18 20:42:54 +01:00
e_logf.c Fix catan, catanh, __ieee754_logf in round-downward mode (bug 16799, bug 16800). 2014-04-02 17:41:02 +00:00
e_powf.c Fix powf (close to -1, large) (bug 18647). 2015-08-05 15:01:58 +00:00
e_rem_pio2f.c Fix leading whitespaces. 2013-06-06 20:36:07 +02:00
e_remainderf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
e_sinhf.c Avoid excess range overflowing results from cosh, sinh, lgamma (bug 18980). 2015-09-18 20:00:48 +00:00
e_sqrtf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
k_cosf.c Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
k_rem_pio2f.c Fix leading whitespaces. 2013-06-06 20:36:07 +02:00
k_sinf.c Fix sin, sincos missing underflows (bug 16526, bug 16538). 2015-06-23 22:24:20 +00:00
k_tanf.c Fix tan missing underflows (bug 16517). 2015-08-07 23:10:35 +00:00
lgamma_negf.c Fix lgamma (negative) inaccuracy (bug 2542, bug 2543, bug 2558). 2015-09-10 22:27:58 +00:00
lgamma_productf.c Fix lgamma (negative) inaccuracy (bug 2542, bug 2543, bug 2558). 2015-09-10 22:27:58 +00:00
mpn2flt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_asinhf.c Fix asinh missing underflows (bug 16350). 2015-06-18 23:27:41 +00:00
s_atanf.c Fix atanf spurious underflows (bug 18196). 2015-05-14 23:51:09 +00:00
s_cbrtf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_ceilf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_copysignf.c Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
s_cosf.c Fix several build failures with GCC6 due to unused static variables. 2015-09-18 20:42:54 +01:00
s_erff.c Fix erfcf spurious underflows (bug 18217). 2015-05-15 00:16:10 +00:00
s_expm1f.c Fix expm1 missing underflows (bug 16353). 2015-06-22 21:06:19 +00:00
s_fabsf.c 2015-05-28 Wilco Dijkstra <wdijkstr@arm.com> 2015-05-28 11:42:55 +01:00
s_finitef.c Reduce number of constants in __finite* (bug 15384). 2015-09-17 16:47:14 +00:00
s_floorf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_fpclassifyf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_frexpf.c Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
s_isinff.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_isnanf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_issignalingf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_llrintf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_llroundf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_log1pf.c Fix log1p missing underflows (bug 16339). 2015-05-14 23:38:07 +00:00
s_logbf.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
s_lrintf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_lroundf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_modff.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_nearbyintf.c Fix nearbyint scheduling of arithmetic past fesetenv (bug 15490). 2013-05-19 18:40:25 +00:00
s_nextafterf.c Fix nextafter overflow in non-default rounding modes (bug 16677). 2014-03-11 22:24:00 +00:00
s_remquof.c Fix sign of remquo zero remainder in round-downward mode (bug 17987). 2015-02-17 00:41:50 +00:00
s_rintf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_roundf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
s_scalblnf.c [BZ #6803] Set errno for scalbln, scalbn 2014-06-20 07:48:20 +05:30
s_scalbnf.c Make scalbn set errno (bug 6803). 2015-09-16 21:11:00 +00:00
s_signbitf.c Use the GCC builtin functions for the non-inlined signbit implementations. 2015-09-18 16:39:08 +01:00
s_sincosf.c Fix sincos errno setting (bug 15467). 2015-02-11 23:17:25 +00:00
s_sinf.c Add optimized sinf and cosf routines for x86 and x86-64 2012-09-03 15:32:13 +02:00
s_tanf.c Use <> for math.h and math_private.h everywhere. 2012-03-09 16:09:10 -08:00
s_tanhf.c Fix tanh missing underflows (bug 16520). 2015-08-13 16:40:39 +00:00
s_truncf.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
t_exp2f.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
w_expf.c This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00