32 #ifdef POK_NEEDS_LIBMATH
35 #include "math_private.h"
37 static const float huge = 1.0e+30, tiny = 1.0e-30;
41 o_threshold = 8.8721679688e+01,
42 ln2_hi = 6.9313812256e-01,
43 ln2_lo = 9.0580006145e-06,
44 invln2 = 1.4426950216e+00,
46 Q1 = -3.3333335072e-02,
47 Q2 = 1.5873016091e-03,
48 Q3 = -7.9365076090e-05,
49 Q4 = 4.0082177293e-06,
50 Q5 = -2.0109921195e-07;
55 float y,hi,lo,c,t,e,hxs,hfx,r1;
62 if(xsb==0) y=x;
else y= -x;
66 if(hx >= 0x4195b844) {
67 if(hx >= 0x42b17218) {
71 return (xsb==0)? x:-1.0;
72 if(x > o_threshold)
return huge*huge;
84 {hi = x - ln2_hi; lo = ln2_lo; k = 1;}
86 {hi = x + ln2_hi; lo = -ln2_lo; k = -1;}
88 k = invln2*x+((xsb==0)?(
float)0.5:(float)-0.5);
96 else if(hx < 0x33000000) {
98 return x - (t-(huge+x));
105 r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5))));
106 t = (float)3.0-r1*hfx;
107 e = hxs*((r1-t)/((
float)6.0 - x*t));
108 if(k==0)
return x - (x*e-hxs);
112 if(k== -1)
return (
float)0.5*(x-e)-(
float)0.5;
114 if(x < (
float)-0.25)
return -(float)2.0*(e-(x+(
float)0.5));
115 else return one+(float)2.0*(x-e);
117 if (k <= -2 || k>56) {
121 SET_FLOAT_WORD(y,i+(k<<23));
127 SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k));
130 SET_FLOAT_WORD(y,i+(k<<23));
133 SET_FLOAT_WORD(t,((0x7f-k)<<23));
137 SET_FLOAT_WORD(y,i+(k<<23));