|
Lines 24-29
Link Here
|
| 24 |
dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */ |
24 |
dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */ |
| 25 |
dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */ |
25 |
dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */ |
| 26 |
zero = 0.0, |
26 |
zero = 0.0, |
|
|
27 |
half = 0.5, |
| 28 |
qrtr = 0.25, |
| 29 |
thrd = 3.33333343e-01, /* 0x3eaaaaab */ |
| 27 |
one = 1.0, |
30 |
one = 1.0, |
| 28 |
two = 2.0, |
31 |
two = 2.0, |
| 29 |
two24 = 16777216.0, /* 0x4b800000 */ |
32 |
two24 = 16777216.0, /* 0x4b800000 */ |
|
Lines 138-144
Link Here
|
| 138 |
/* now |1-x| is tiny <= 2**-20, suffice to compute |
141 |
/* now |1-x| is tiny <= 2**-20, suffice to compute |
| 139 |
log(x) by x-x^2/2+x^3/3-x^4/4 */ |
142 |
log(x) by x-x^2/2+x^3/3-x^4/4 */ |
| 140 |
t = ax-1; /* t has 20 trailing zeros */ |
143 |
t = ax-1; /* t has 20 trailing zeros */ |
| 141 |
w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); |
144 |
w = (t*t)*(half-t*(thrd-t*qrtr)); |
| 142 |
u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ |
145 |
u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ |
| 143 |
v = t*ivln2_l-w*ivln2; |
146 |
v = t*ivln2_l-w*ivln2; |
| 144 |
t1 = u+v; |
147 |
t1 = u+v; |
|
Lines 177-186
Link Here
|
| 177 |
r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); |
180 |
r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); |
| 178 |
r += s_l*(s_h+s); |
181 |
r += s_l*(s_h+s); |
| 179 |
s2 = s_h*s_h; |
182 |
s2 = s_h*s_h; |
| 180 |
t_h = (float)3.0+s2+r; |
183 |
t_h = 3+s2+r; |
| 181 |
GET_FLOAT_WORD(is,t_h); |
184 |
GET_FLOAT_WORD(is,t_h); |
| 182 |
SET_FLOAT_WORD(t_h,is&0xfffff000); |
185 |
SET_FLOAT_WORD(t_h,is&0xfffff000); |
| 183 |
t_l = r-((t_h-(float)3.0)-s2); |
186 |
t_l = r-((t_h-3)-s2); |
| 184 |
/* u+v = s*(1+...) */ |
187 |
/* u+v = s*(1+...) */ |
| 185 |
u = s_h*t_h; |
188 |
u = s_h*t_h; |
| 186 |
v = s_l*t_h+t_l*s; |
189 |
v = s_l*t_h+t_l*s; |
|
Lines 192-198
Link Here
|
| 192 |
z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ |
195 |
z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ |
| 193 |
z_l = cp_l*p_h+p_l*cp+dp_l[k]; |
196 |
z_l = cp_l*p_h+p_l*cp+dp_l[k]; |
| 194 |
/* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ |
197 |
/* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ |
| 195 |
t = (float)n; |
198 |
t = n; |
| 196 |
t1 = (((z_h+z_l)+dp_h[k])+t); |
199 |
t1 = (((z_h+z_l)+dp_h[k])+t); |
| 197 |
GET_FLOAT_WORD(is,t1); |
200 |
GET_FLOAT_WORD(is,t1); |
| 198 |
SET_FLOAT_WORD(t1,is&0xfffff000); |
201 |
SET_FLOAT_WORD(t1,is&0xfffff000); |