glibc/sysdeps/ieee754/flt-32
Szabolcs Nagy 505b5b2922 Fix powf overflow handling in non-nearest rounding mode [BZ #23961]
The threshold value at which powf overflows depends on the rounding mode
and the current check did not take this into account. So when the result
was rounded away from zero it could become infinity without setting
errno to ERANGE.

Example: pow(0x1.7ac7cp+5, 23) is 0x1.fffffep+127 + 0.1633ulp

If the result goes above 0x1.fffffep+127 + 0.5ulp then errno is set,
which is fine in nearest rounding mode, but

  powf(0x1.7ac7cp+5, 23) is inf in upward rounding mode
  powf(-0x1.7ac7cp+5, 23) is -inf in downward rounding mode

and the previous implementation did not set errno in these cases.

The fix tries to avoid affecting the common code path or calling a
function that may introduce a stack frame, so float arithmetics is used
to check the rounding mode and the threshold is selected accordingly.

	[BZ #23961]
	* math/auto-libm-test-in: Add new test case.
	* math/auto-libm-test-out-pow: Regenerated.
	* sysdeps/ieee754/flt-32/e_powf.c (__powf): Fix overflow check.
2018-12-11 10:01:43 +00:00
..
e_acosf.c
e_acoshf.c
e_asinf.c
e_atan2f.c
e_atanhf.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
e_coshf.c
e_exp2f_data.c
e_exp2f.c
e_expf.c Clean up converttoint handling and document the semantics 2018-08-10 17:23:16 +01:00
e_fmodf.c
e_gammaf_r.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
e_hypotf.c
e_ilogbf.c
e_j0f.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
e_j1f.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
e_jnf.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
e_lgammaf_r.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
e_log2f_data.c
e_log2f.c
e_log10f.c
e_logf_data.c
e_logf.c
e_powf_log2_data.c
e_powf.c Fix powf overflow handling in non-nearest rounding mode [BZ #23961] 2018-12-11 10:01:43 +00:00
e_remainderf.c
e_sinhf.c
e_sqrtf.c
k_tanf.c
lgamma_negf.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
lgamma_productf.c
math_config.h Clean up converttoint handling and document the semantics 2018-08-10 17:23:16 +01:00
math_errf.c Use uint32_t sign in single precision math error handling functions 2018-07-02 09:29:04 +01:00
mpn2flt.c
s_asinhf.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
s_atanf.c
s_cbrtf.c Remove unnecessary math_private.h includes. 2018-09-28 21:53:33 +00:00
s_ceilf.c Use ceil functions not __ceil functions in glibc libm. 2018-09-17 20:42:06 +00:00
s_copysignf.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
s_cosf.c Improve performance of sinf and cosf 2018-08-14 10:45:59 +01:00
s_erff.c
s_expm1f.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_fabsf.c
s_finitef.c
s_floorf.c Use floor functions not __floor functions in glibc libm. 2018-09-14 13:09:01 +00:00
s_fpclassifyf.c
s_frexpf.c
s_fromfpf_main.c
s_fromfpf.c
s_fromfpxf.c
s_getpayloadf.c
s_isinff.c
s_isnanf.c
s_issignalingf.c
s_llrintf.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_llroundf.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_log1pf.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_logbf.c
s_lrintf.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_lroundf.c Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
s_modff.c
s_nearbyintf.c Do not include fenv_private.h in math_private.h. 2018-09-03 21:09:04 +00:00
s_nextafterf.c Do not include math-barriers.h in math_private.h. 2018-05-11 15:11:38 +00:00
s_nextupf.c
s_remquof.c
s_rintf.c Use rint functions not __rint functions in glibc libm. 2018-09-14 13:10:39 +00:00
s_roundevenf.c
s_roundf.c Use round functions not __round functions in glibc libm. 2018-09-27 12:35:23 +00:00
s_scalblnf.c
s_scalbnf.c Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
s_setpayloadf_main.c
s_setpayloadf.c
s_setpayloadsigf.c
s_signbitf.c
s_sincosf_data.c Improve performance of sincosf 2018-08-10 17:34:39 +01:00
s_sincosf.c Improve performance of sincosf 2018-08-10 17:34:39 +01:00
s_sincosf.h Improve performance of sinf and cosf 2018-08-14 10:45:59 +01:00
s_sinf.c Improve performance of sinf and cosf 2018-08-14 10:45:59 +01:00
s_tanf.c Speedup tanf range reduction 2018-08-23 12:38:16 +01:00
s_tanhf.c
s_totalorderf.c
s_totalordermagf.c
s_truncf.c Use trunc functions not __trunc functions in glibc libm. 2018-09-20 21:11:10 +00:00
s_ufromfpf.c
s_ufromfpxf.c
w_exp2f.c
w_expf.c
w_log2f.c
w_logf.c
w_powf.c