32 #ifdef POK_NEEDS_LIBMATH
35 #include "math_private.h"
38 ln2_hi = 6.9313812256e-01,
39 ln2_lo = 9.0580006145e-06,
40 two25 = 3.355443200e+07,
41 Lp1 = 6.6666668653e-01,
42 Lp2 = 4.0000000596e-01,
43 Lp3 = 2.8571429849e-01,
44 Lp4 = 2.2222198546e-01,
45 Lp5 = 1.8183572590e-01,
46 Lp6 = 1.5313838422e-01,
47 Lp7 = 1.4798198640e-01;
49 static const float zero = 0.0;
54 float hfsq,f,c,s,z,R,u;
63 if (hx < 0x3ed413d7) {
65 if(x==(
float)-1.0)
return -two25/zero;
66 else return (x-x)/(x-x);
73 return x - x*x*(float)0.5;
75 if(hx>0||hx<=((int32_t)0xbe95f61f)) {
78 if (hx >= 0x7f800000)
return x+x;
85 c = (k>0)? (
float)1.0-(u-x):x-(u-(
float)1.0);
95 SET_FLOAT_WORD(u,hu|0x3f800000);
98 SET_FLOAT_WORD(u,hu|0x3f000000);
99 hu = (0x00800000-hu)>>2;
105 if(f==zero) {
if(k==0)
return zero;
106 else {c += k*ln2_lo;
return k*ln2_hi+c;}
108 R = hfsq*((float)1.0-(
float)0.66666666666666666*f);
109 if(k==0)
return f-R;
else
110 return k*ln2_hi-((R-(k*ln2_lo+c))-f);
112 s = f/((float)2.0+f);
114 R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7))))));
115 if(k==0)
return f-(hfsq-s*(hfsq+R));
else
116 return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f);