32 #ifdef POK_NEEDS_LIBMATH
34 #include "math_private.h"
36 static const float huge = 1.0e+30;
40 halF[2] = {0.5,-0.5,},
41 twom100 = 7.8886090522e-31,
42 o_threshold= 8.8721679688e+01,
43 u_threshold= -1.0397208405e+02,
44 ln2HI[2] ={ 6.9313812256e-01,
46 ln2LO[2] ={ 9.0580006145e-06,
48 invln2 = 1.4426950216e+00,
49 P1 = 1.6666667163e-01,
50 P2 = -2.7777778450e-03,
51 P3 = 6.6137559770e-05,
52 P4 = -1.6533901999e-06,
53 P5 = 4.1381369442e-08;
56 __ieee754_expf(
float x)
69 if(hx >= 0x42b17218) {
73 return (xsb==0)? x:0.0;
74 if(x > o_threshold)
return huge*huge;
75 if(x < u_threshold)
return twom100*twom100;
81 hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
83 k = invln2*x+halF[xsb];
90 else if(hx < 0x31800000) {
91 if(huge+x>one)
return one+x;
97 c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
98 if(k==0)
return one-((x*c)/(c-(
float)2.0)-x);
99 else y = one-((lo-(x*c)/((
float)2.0-c))-hi);
102 GET_FLOAT_WORD(hy,y);
103 SET_FLOAT_WORD(y,hy+(k<<23));
107 GET_FLOAT_WORD(hy,y);
108 SET_FLOAT_WORD(y,hy+((k+100)<<23));