diff options
author | Joseph Myers <joseph@codesourcery.com> | 2015-08-05 15:01:58 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2015-08-05 15:01:58 +0000 |
commit | cf36e5034fa8ed5d44036bce09a55a7f00d19252 (patch) | |
tree | 9fca061d81056a70793ebee9bf828b4e5b97f724 /sysdeps | |
parent | 2aa6c8af26e65695e9daf382a6e508574a30cdf2 (diff) | |
download | glibc-cf36e5034fa8ed5d44036bce09a55a7f00d19252.tar glibc-cf36e5034fa8ed5d44036bce09a55a7f00d19252.tar.gz glibc-cf36e5034fa8ed5d44036bce09a55a7f00d19252.tar.bz2 glibc-cf36e5034fa8ed5d44036bce09a55a7f00d19252.zip |
Fix powf (close to -1, large) (bug 18647).
The flt-32 implementation of powf wrongly uses x-1 instead of |x|-1
when computing log (x) for the case where |x| is close to 1 and y is
large. This patch fixes the logic accordingly. Relevant tests
existed for x close to 1, and corresponding tests are added for x
close to -1, as well as for some new variant cases.
Tested for x86_64 and x86.
[BZ #18647]
* sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): For large y
and |x| close to 1, use absolute value of x when computing log.
* math/auto-libm-test-in: Add more tests of pow.
* math/auto-libm-test-out: Regenerated.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/ieee754/flt-32/e_powf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/ieee754/flt-32/e_powf.c b/sysdeps/ieee754/flt-32/e_powf.c index 12c408f93c..8e8d918456 100644 --- a/sysdeps/ieee754/flt-32/e_powf.c +++ b/sysdeps/ieee754/flt-32/e_powf.c @@ -131,7 +131,7 @@ __ieee754_powf(float x, float y) if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny; /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = x-1; /* t has 20 trailing zeros */ + t = ax-1; /* t has 20 trailing zeros */ w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ v = t*ivln2_l-w*ivln2; |