Changeset View
Changeset View
Standalone View
Standalone View
lib/msun/src/e_powf.c
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | __ieee754_powf(float x, float y) | ||||
if((n|yisint)==0) return (x-x)/(x-x); | if((n|yisint)==0) return (x-x)/(x-x); | ||||
sn = one; /* s (sign of result -ve**odd) = -1 else = 1 */ | sn = one; /* s (sign of result -ve**odd) = -1 else = 1 */ | ||||
if((n|(yisint-1))==0) sn = -one;/* (-ve)**(odd int) */ | if((n|(yisint-1))==0) sn = -one;/* (-ve)**(odd int) */ | ||||
/* |y| is huge */ | /* |y| is huge */ | ||||
if(iy>0x4d000000) { /* if |y| > 2**27 */ | if(iy>0x4d000000) { /* if |y| > 2**27 */ | ||||
/* over/underflow if x is not close to one */ | /* over/underflow if x is not close to one */ | ||||
if(ix<0x3f7ffff7) return (hy<0)? sn*huge*huge:sn*tiny*tiny; | if(ix<0x3f7ffff6) return (hy<0)? sn*huge*huge:sn*tiny*tiny; | ||||
if(ix>0x3f800007) return (hy>0)? sn*huge*huge:sn*tiny*tiny; | if(ix>0x3f800007) return (hy>0)? sn*huge*huge:sn*tiny*tiny; | ||||
/* now |1-x| is tiny <= 2**-20, suffice to compute | /* now |1-x| is tiny <= 2**-20, suffice to compute | ||||
log(x) by x-x^2/2+x^3/3-x^4/4 */ | log(x) by x-x^2/2+x^3/3-x^4/4 */ | ||||
t = ax-1; /* t has 20 trailing zeros */ | t = ax-1; /* t has 20 trailing zeros */ | ||||
w = (t*t)*(half-t*(thrd-t*qrtr)); | w = (t*t)*(half-t*(thrd-t*qrtr)); | ||||
u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ | u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ | ||||
v = t*ivln2_l-w*ivln2; | v = t*ivln2_l-w*ivln2; | ||||
t1 = u+v; | t1 = u+v; | ||||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |