acadia-newlib/newlib/libm/common
Szabolcs Nagy df6915f029 Fix powf overflow handling in non-nearest rounding mode
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.
2018-12-10 16:51:05 +01:00
..
Makefile.am New pow implementation 2018-06-27 15:40:49 +02:00
Makefile.in New pow implementation 2018-06-27 15:40:49 +02:00
acoshl.c
acosl.c
asinhl.c
asinl.c
atan2l.c
atanhl.c
atanl.c
cbrtl.c
ceill.c
copysignl.c
cosf.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
coshl.c
cosl.c
erfcl.c
erfl.c
exp.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
exp2.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
exp2l.c
exp_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
expl.c
expm1l.c
fabsl.c
fdiml.c
fdlibm.h New pow implementation 2018-06-27 15:40:49 +02:00
floorl.c
fmal.c
fmaxl.c
fminl.c
fmodl.c
frexpl.c
hypotl.c * libc/include/complex.h (cabsl): Add prototype. 2015-02-06 16:14:04 +00:00
ilogbl.c
isgreater.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
ldexpl.c
lgammal.c
llrintl.c
llroundl.c
local.h
log.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
log1pl.c
log2.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
log2_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
log2l.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
log10l.c
log_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
logbl.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
logl.c
lrintl.c
lroundl.c
math_config.h Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
math_err.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
math_errf.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
modfl.c 2013-11-19 Joel Sherrill <joel.sherrill@oarcorp.com> 2013-11-19 17:28:04 +00:00
nanl.c Implement nanl in newlib only 2018-10-10 17:49:53 +02:00
nearbyintl.c
nextafterl.c
nexttoward.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
nexttowardf.c Use _LDBL_EQ_DBL in nexttowardf.c 2018-05-07 12:22:12 -04:00
nexttowardl.c 2014-12-15 Jonathan Roelofs <jonathan@codesourcery.com> 2014-12-15 20:50:23 +00:00
pow.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
pow_log_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
powl.c
remainderl.c
remquol.c
rintl.c
roundl.c
s_cbrt.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_copysign.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_exp10.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_expm1.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_fdim.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_finite.c
s_fma.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_fmax.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_fmin.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_fpclassify.c
s_ilogb.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_infinity.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_isinf.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
s_isinfd.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
s_isnan.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_isnand.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
s_lib_ver.c
s_llrint.c fix llrint and lrint for 52 <= exponent <= 62 2018-05-29 15:59:48 +02:00
s_llround.c
s_log1p.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_log2.c New log2 implementation 2018-06-27 15:40:49 +02:00
s_logb.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_lrint.c fix llrint and lrint for 52 <= exponent <= 62 2018-05-29 15:59:48 +02:00
s_lround.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_matherr.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_modf.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_nan.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_nearbyint.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_nextafter.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_pow10.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_remquo.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_rint.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_round.c libm/common/s_round.c (round): Add cast for 16-bit CPUs 2018-06-21 09:31:13 +02:00
s_scalbln.c
s_scalbn.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_signbit.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
s_trunc.c libm/common: remove TRAD_SYNOPSIS 2017-12-01 03:41:53 -06:00
scalblnl.c
scalbnl.c
sf_cbrt.c
sf_copysign.c
sf_exp.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sf_exp2.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sf_exp2_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sf_exp10.c
sf_expm1.c
sf_fdim.c
sf_finite.c
sf_fma.c
sf_fmax.c
sf_fmin.c
sf_fpclassify.c
sf_ilogb.c
sf_infinity.c
sf_isinf.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
sf_isinff.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
sf_isnan.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
sf_isnanf.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
sf_llrint.c
sf_llround.c
sf_log.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sf_log1p.c
sf_log2.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sf_log2_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sf_log_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sf_logb.c
sf_lrint.c
sf_lround.c
sf_modf.c
sf_nan.c 2014-03-21 Maciej W. Rozycki <macro@codesourcery.com> 2014-03-21 21:27:29 +00:00
sf_nearbyint.c
sf_nextafter.c
sf_pow.c Fix powf overflow handling in non-nearest rounding mode 2018-12-10 16:51:05 +01:00
sf_pow10.c
sf_pow_log2_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sf_remquo.c
sf_rint.c
sf_round.c
sf_scalbln.c
sf_scalbn.c
sf_trunc.c
sincosf.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sincosf.h Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sincosf_data.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sinf.c Update Arm copyright notices in new math files 2018-09-28 11:03:55 +01:00
sinhl.c
sinl.c
sl_finite.c finitel: Use correct GCC builtin 2016-03-26 20:29:20 +01:00
sqrtl.c newlib: fix various gcc warnings 2018-08-08 10:50:19 +02:00
tanhl.c
tanl.c
tgammal.c
truncl.c