summaryrefslogtreecommitdiffstats
path: root/lib/msun/src/s_cbrtf.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2005-12-11 17:58:14 +0000
committerbde <bde@FreeBSD.org>2005-12-11 17:58:14 +0000
commit94455e43e18e7ebc1855d1bc76e56c968da93a10 (patch)
treeadf9ca1a138cb3ea918385a3860d53169ab0d404 /lib/msun/src/s_cbrtf.c
parent3c8b4e6094d5c1495a556a0e884a9c0e16f97af0 (diff)
downloadFreeBSD-src-94455e43e18e7ebc1855d1bc76e56c968da93a10.zip
FreeBSD-src-94455e43e18e7ebc1855d1bc76e56c968da93a10.tar.gz
Fixed the unexpectedly large maximum error after the previous commit.
It was because I forgot to translate the part of the double precision algorithm that chops t so that t*t is exact. Now the maximum error is the same as for double precision (almost exactly 2.0/3 ulps).
Diffstat (limited to 'lib/msun/src/s_cbrtf.c')
-rw-r--r--lib/msun/src/s_cbrtf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/msun/src/s_cbrtf.c b/lib/msun/src/s_cbrtf.c
index 882ed0a..1453ac2 100644
--- a/lib/msun/src/s_cbrtf.c
+++ b/lib/msun/src/s_cbrtf.c
@@ -67,9 +67,9 @@ cbrtf(float x)
/* chop t to 12 bits and make it larger than cbrt(x) */
GET_FLOAT_WORD(high,t);
- SET_FLOAT_WORD(t,high+0x00001000);
+ SET_FLOAT_WORD(t,(high&0xfffff000)+0x00001000);
- /* one step Newton iteration to 24 bits with error less than 0.984 ulps */
+ /* one step Newton iteration to 24 bits with error less than 0.667 ulps */
s=t*t; /* t*t is exact */
r=x/s;
w=t+t;
OpenPOWER on IntegriCloud