View | Details | Raw Unified | Return to bug 229420
Collapse All | Expand All

(-)./src/e_pow.c (-4 / +7 lines)
Lines 65-70 Link Here
65
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
65
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
66
dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
66
dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
67
zero    =  0.0,
67
zero    =  0.0,
68
half    =  0.5,
69
qrtr    =  0.25,
70
thrd    =  3.3333333333333331e-01, /* 0x3fd55555, 0x55555555 */
68
one	=  1.0,
71
one	=  1.0,
69
two	=  2.0,
72
two	=  2.0,
70
two53	=  9007199254740992.0,	/* 0x43400000, 0x00000000 */
73
two53	=  9007199254740992.0,	/* 0x43400000, 0x00000000 */
Lines 197-203 Link Here
197
	/* now |1-x| is tiny <= 2**-20, suffice to compute
200
	/* now |1-x| is tiny <= 2**-20, suffice to compute
198
	   log(x) by x-x^2/2+x^3/3-x^4/4 */
201
	   log(x) by x-x^2/2+x^3/3-x^4/4 */
199
	    t = ax-one;		/* t has 20 trailing zeros */
202
	    t = ax-one;		/* t has 20 trailing zeros */
200
	    w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
203
	    w = (t*t)*(half-t*(thrd-t*qrtr));
201
	    u = ivln2_h*t;	/* ivln2_h has 21 sig. bits */
204
	    u = ivln2_h*t;	/* ivln2_h has 21 sig. bits */
202
	    v = t*ivln2_l-w*ivln2;
205
	    v = t*ivln2_l-w*ivln2;
203
	    t1 = u+v;
206
	    t1 = u+v;
Lines 234-242 Link Here
234
	    r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6)))));
237
	    r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6)))));
235
	    r += s_l*(s_h+ss);
238
	    r += s_l*(s_h+ss);
236
	    s2  = s_h*s_h;
239
	    s2  = s_h*s_h;
237
	    t_h = 3.0+s2+r;
240
	    t_h = 3+s2+r;
238
	    SET_LOW_WORD(t_h,0);
241
	    SET_LOW_WORD(t_h,0);
239
	    t_l = r-((t_h-3.0)-s2);
242
	    t_l = r-((t_h-3)-s2);
240
	/* u+v = ss*(1+...) */
243
	/* u+v = ss*(1+...) */
241
	    u = s_h*t_h;
244
	    u = s_h*t_h;
242
	    v = s_l*t_h+t_l*ss;
245
	    v = s_l*t_h+t_l*ss;
Lines 247-253 Link Here
247
	    z_h = cp_h*p_h;		/* cp_h+cp_l = 2/(3*log2) */
250
	    z_h = cp_h*p_h;		/* cp_h+cp_l = 2/(3*log2) */
248
	    z_l = cp_l*p_h+p_l*cp+dp_l[k];
251
	    z_l = cp_l*p_h+p_l*cp+dp_l[k];
249
	/* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */
252
	/* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */
250
	    t = (double)n;
253
	    t = n;
251
	    t1 = (((z_h+z_l)+dp_h[k])+t);
254
	    t1 = (((z_h+z_l)+dp_h[k])+t);
252
	    SET_LOW_WORD(t1,0);
255
	    SET_LOW_WORD(t1,0);
253
	    t2 = z_l-(((t1-t)-dp_h[k])-z_h);
256
	    t2 = z_l-(((t1-t)-dp_h[k])-z_h);
(-)./src/e_powf.c (-4 / +7 lines)
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);

Return to bug 229420