aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2004-06-01 19:03:31 +0000
committerBruce Evans <bde@FreeBSD.org>2004-06-01 19:03:31 +0000
commit5f20e5ce7f396ad064bfc1f45b8075ea1c0580f9 (patch)
treed047d2f81364d19ccc22c5e5d8ab9a59b0362f34 /lib
parent4b5f40757940db3fd8c0ddb5500537a75a6d7501 (diff)
downloadsrc-5f20e5ce7f396ad064bfc1f45b8075ea1c0580f9.tar.gz
src-5f20e5ce7f396ad064bfc1f45b8075ea1c0580f9.zip
Fixed another precision bug in powf(). This one is in the computation
[t=p_l+p_h High]. We multiply t by lg2_h, and want the result to be exact. For the bogus float case of the high-low decomposition trick, we normally discard the lowest 12 bits of the fraction for the high part, keeping 12 bits of precision. That was used for t here, but it doesnt't work because for some reason we only discard the lowest 9 bits in the fraction for lg2_h. Discard another 3 bits of the fraction for t to compensate. This bug gave wrong results like: powf(0.9999999, -2.9999995) = 1.0000002 (should be 1.0000001) hex values: 3F7FFFFF C03FFFFE 3F800002 3F800001 As explained in the log for the previous commit, the bug is normally masked by doing float calculations in extra precision on i386's, but is easily detected by ucbtest on systems that don't have accidental extra precision. This completes fixing all the bugs in powf() that were routinely found by ucbtest.
Notes
Notes: svn path=/head/; revision=129955
Diffstat (limited to 'lib')
-rw-r--r--lib/msun/src/e_powf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/msun/src/e_powf.c b/lib/msun/src/e_powf.c
index a9dc533d3443..75fd801c2196 100644
--- a/lib/msun/src/e_powf.c
+++ b/lib/msun/src/e_powf.c
@@ -229,7 +229,7 @@ __ieee754_powf(float x, float y)
}
t = p_l+p_h;
GET_FLOAT_WORD(is,t);
- SET_FLOAT_WORD(t,is&0xfffff000);
+ SET_FLOAT_WORD(t,is&0xffff8000);
u = t*lg2_h;
v = (p_l-(t-p_h))*lg2+t*lg2_l;
z = u+v;