124 #ifdef POK_NEEDS_LIBMATH
127 #include "math_private.h"
133 o_threshold = 7.09782712893383973096e+02,
134 ln2_hi = 6.93147180369123816490e-01,
135 ln2_lo = 1.90821492927058770002e-10,
136 invln2 = 1.44269504088896338700e+00,
138 Q1 = -3.33333333333331316428e-02,
139 Q2 = 1.58730158725481460165e-03,
140 Q3 = -7.93650757867487942473e-05,
141 Q4 = 4.00821782732936239552e-06,
142 Q5 = -2.01099218183624371326e-07;
147 double y,hi,lo,c,t,e,hxs,hfx,r1;
154 if(xsb==0) y=x;
else y= -x;
158 if(hx >= 0x4043687A) {
159 if(hx >= 0x40862E42) {
163 if(((hx&0xfffff)|low)!=0)
165 else return (xsb==0)? x:-1.0;
167 if(x > o_threshold)
return huge*huge;
176 if(hx > 0x3fd62e42) {
177 if(hx < 0x3FF0A2B2) {
179 {hi = x - ln2_hi; lo = ln2_lo; k = 1;}
181 {hi = x + ln2_hi; lo = -ln2_lo; k = -1;}
183 k = invln2*x+((xsb==0)?0.5:-0.5);
191 else if(hx < 0x3c900000) {
193 return x - (t-(huge+x));
200 r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5))));
202 e = hxs*((r1-t)/(6.0 - x*t));
203 if(k==0)
return x - (x*e-hxs);
207 if(k== -1)
return 0.5*(x-e)-0.5;
209 if(x < -0.25)
return -2.0*(e-(x+0.5));
210 else return one+2.0*(x-e);
212 if (k <= -2 || k>56) {
215 GET_HIGH_WORD(high,y);
216 SET_HIGH_WORD(y,high+(k<<20));
222 SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k));
224 GET_HIGH_WORD(high,y);
225 SET_HIGH_WORD(y,high+(k<<20));
228 SET_HIGH_WORD(t,((0x3ff-k)<<20));
231 GET_HIGH_WORD(high,y);
232 SET_HIGH_WORD(y,high+(k<<20));