32 #ifdef POK_NEEDS_LIBMATH
34 #include "math_private.h"
37 ln2 = 0.6931471805599452862268,
38 two25 = 3.355443200e+07,
39 Lg1 = 6.6666668653e-01,
40 Lg2 = 4.0000000596e-01,
41 Lg3 = 2.8571429849e-01,
42 Lg4 = 2.2222198546e-01,
43 Lg5 = 1.8183572590e-01,
44 Lg6 = 1.5313838422e-01,
45 Lg7 = 1.4798198640e-01;
47 static const float zero = 0.0;
50 __ieee754_log2f(
float x)
52 float hfsq,f,s,z,R,w,t1,t2,dk;
58 if (ix < 0x00800000) {
59 if ((ix&0x7fffffff)==0)
61 if (ix<0)
return (x-x)/zero;
65 if (ix >= 0x7f800000)
return x+x;
68 i = (ix+(0x95f64<<3))&0x800000;
69 SET_FLOAT_WORD(x,ix|(i^0x3f800000));
73 if((0x007fffff&(15+ix))<16) {
76 R = f*f*((float)0.5-(
float)0.33333333333333333*f);
77 return (dk-(R-f)/ln2);
84 t1= w*(Lg2+w*(Lg4+w*Lg6));
85 t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
90 return (dk-(hfsq-s*(hfsq+R)-f)/ln2);
92 return (dk-((s*(f-R))-f)/ln2);