94 #ifdef POK_NEEDS_LIBMATH
97 #include "math_private.h"
100 ln2_hi = 6.93147180369123816490e-01,
101 ln2_lo = 1.90821492927058770002e-10,
102 two54 = 1.80143985094819840000e+16,
103 Lp1 = 6.666666666666735130e-01,
104 Lp2 = 3.999999999940941908e-01,
105 Lp3 = 2.857142874366239149e-01,
106 Lp4 = 2.222219843214978396e-01,
107 Lp5 = 1.818357216161805012e-01,
108 Lp6 = 1.531383769920937332e-01,
109 Lp7 = 1.479819860511658591e-01;
111 static const double zero = 0.0;
116 double hfsq,f,c,s,z,R,u;
125 if (hx < 0x3FDA827A) {
127 if(x==-1.0)
return -two54/zero;
128 else return (x-x)/(x-x);
137 if(hx>0||hx<=((int32_t)0xbfd2bec3)) {
140 if (hx >= 0x7ff00000)
return x+x;
146 c = (k>0)? 1.0-(u-x):x-(u-1.0);
156 SET_HIGH_WORD(u,hu|0x3ff00000);
159 SET_HIGH_WORD(u,hu|0x3fe00000);
160 hu = (0x00100000-hu)>>2;
166 if(f==zero) {
if(k==0)
return zero;
167 else {c += k*ln2_lo;
return k*ln2_hi+c;}
169 R = hfsq*(1.0-0.66666666666666666*f);
170 if(k==0)
return f-R;
else
171 return k*ln2_hi-((R-(k*ln2_lo+c))-f);
175 R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7))))));
176 if(k==0)
return f-(hfsq-s*(hfsq+R));
else
177 return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f);