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).
This commit is contained in:
Bruce Evans 2005-12-11 17:58:14 +00:00
parent 21aab1d809
commit 288a8c86cb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=153305

View file

@ -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;