summaryrefslogtreecommitdiffstats
path: root/lib/msun
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2005-11-23 03:03:09 +0000
committerbde <bde@FreeBSD.org>2005-11-23 03:03:09 +0000
commit89ac9def6aab31e249a8748547b537afbbd85c5f (patch)
treea02cb27ee19b34ca78a2ec11cc08fc5a82abee2e /lib/msun
parent67ff03dd57510489a17d08d9df09e320ed2309f7 (diff)
downloadFreeBSD-src-89ac9def6aab31e249a8748547b537afbbd85c5f.zip
FreeBSD-src-89ac9def6aab31e249a8748547b537afbbd85c5f.tar.gz
Simplified setiing up args for __kernel_rem_pio2(). We already have x
with a 24-bit fraction, so we don't need a loop to split it into up to 3 terms with 24-bit fractions.
Diffstat (limited to 'lib/msun')
-rw-r--r--lib/msun/src/e_rem_pio2f.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/msun/src/e_rem_pio2f.c b/lib/msun/src/e_rem_pio2f.c
index c93ebd3..261323b 100644
--- a/lib/msun/src/e_rem_pio2f.c
+++ b/lib/msun/src/e_rem_pio2f.c
@@ -61,9 +61,10 @@ pio2_1t = 6.07710050650619224932e-11; /* 0x3DD0B461, 0x1A626331 */
int32_t __ieee754_rem_pio2f(float x, float *y)
{
- double z,w,t,r,fn;
- double tx[3],ty[2];
- int32_t e0,i,nx,n,ix,hx;
+ double w,t,r,fn;
+ double tx[1],ty[2];
+ float z;
+ int32_t e0,n,ix,hx;
GET_FLOAT_WORD(hx,x);
ix = hx&0x7fffffff;
@@ -85,20 +86,11 @@ pio2_1t = 6.07710050650619224932e-11; /* 0x3DD0B461, 0x1A626331 */
if(ix>=0x7f800000) { /* x is inf or NaN */
y[0]=y[1]=x-x; return 0;
}
- /* set z = scalbn(|x|,ilogb(x)-23) */
- z = x;
- GET_HIGH_WORD(hx,z);
- ix = hx&0x7fffffff;
- e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */
- SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20)));
- for(i=0;i<2;i++) {
- tx[i] = (double)((int32_t)(z));
- z = (z-tx[i])*two24;
- }
- tx[2] = z;
- nx = 3;
- while(tx[nx-1]==zero) nx--; /* skip zero term */
- n = __kernel_rem_pio2(tx,ty,e0,nx,1,two_over_pi);
+ /* set z = scalbn(|x|,ilogb(|x|)-23) */
+ e0 = (ix>>23)-150; /* e0 = ilogb(|x|)-23; */
+ SET_FLOAT_WORD(z, ix - ((int32_t)(e0<<23)));
+ tx[0] = z;
+ n = __kernel_rem_pio2(tx,ty,e0,1,1,two_over_pi);
y[0] = ty[0];
y[1] = ty[0] - y[0];
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
OpenPOWER on IntegriCloud