32 #ifdef POK_NEEDS_LIBMATH
34 #include "math_private.h"
37 ln2_hi = 6.9313812256e-01,
38 ln2_lo = 9.0580006145e-06,
39 two25 = 3.355443200e+07,
40 Lg1 = 6.6666668653e-01,
41 Lg2 = 4.0000000596e-01,
42 Lg3 = 2.8571429849e-01,
43 Lg4 = 2.2222198546e-01,
44 Lg5 = 1.8183572590e-01,
45 Lg6 = 1.5313838422e-01,
46 Lg7 = 1.4798198640e-01;
48 static const float zero = 0.0;
51 __ieee754_logf(
float x)
53 float hfsq,f,s,z,R,w,t1,t2,dk;
59 if (ix < 0x00800000) {
60 if ((ix&0x7fffffff)==0)
62 if (ix<0)
return (x-x)/zero;
66 if (ix >= 0x7f800000)
return x+x;
69 i = (ix+(0x95f64<<3))&0x800000;
70 SET_FLOAT_WORD(x,ix|(i^0x3f800000));
73 if((0x007fffff&(15+ix))<16) {
74 if(f==zero) {
if(k==0)
return zero;
else {dk=(float)k;
75 return dk*ln2_hi+dk*ln2_lo;}
77 R = f*f*((float)0.5-(
float)0.33333333333333333*f);
78 if(k==0)
return f-R;
else {dk=(float)k;
79 return dk*ln2_hi-((R-dk*ln2_lo)-f);}
87 t1= w*(Lg2+w*(Lg4+w*Lg6));
88 t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
93 if(k==0)
return f-(hfsq-s*(hfsq+R));
else
94 return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f);
96 if(k==0)
return f-s*(f-R);
else
97 return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f);