diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2018-12-10 12:53:01 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2018-12-10 13:05:43 +0000 |
commit | 6e60567b9bbf59b38c72493faf7cc9eb6ce43c64 (patch) | |
tree | 8d39ed7c1da5a397ce176bdb57b74d442ba40316 | |
parent | 04884bd04eac4b251da4026900010ea7d8850edc (diff) | |
download | arm-optimized-routines-6e60567b9bbf59b38c72493faf7cc9eb6ce43c64.tar.gz |
Change the powf overflow handling
This fix is slightly more correct than the previous one (which introduced
a 1ulp error when rounding toward zero near the overflow limit) and has
slightly smaller code size.
-rw-r--r-- | math/powf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/math/powf.c b/math/powf.c index 385719b..1149842 100644 --- a/math/powf.c +++ b/math/powf.c @@ -204,8 +204,11 @@ powf (float x, float y) if (WANT_ROUNDING && WANT_ERRNO && ylogx > 0x1.fffffffa3aae2p+6 * POWF_SCALE) /* |x^y| > 0x1.fffffep127, check if we round away from 0. */ - if ((!sign_bias && opt_barrier_float (-ylogx) != -128 * POWF_SCALE) - || (sign_bias && -opt_barrier_float (ylogx) != -128 * POWF_SCALE)) + if ((!sign_bias + && eval_as_float (1.0f + opt_barrier_float (0x1p-25f)) != 1.0f) + || (sign_bias + && eval_as_float (-1.0f - opt_barrier_float (0x1p-25f)) + != -1.0f)) return __math_oflowf (sign_bias); if (ylogx <= -150.0 * POWF_SCALE) return __math_uflowf (sign_bias); |