96 #ifdef POK_NEEDS_LIBMATH
99 #include "math_private.h"
102 two52= 4.50359962737049600000e+15,
103 half= 5.00000000000000000000e-01,
104 one = 1.00000000000000000000e+00,
105 pi = 3.14159265358979311600e+00,
106 a0 = 7.72156649015328655494e-02,
107 a1 = 3.22467033424113591611e-01,
108 a2 = 6.73523010531292681824e-02,
109 a3 = 2.05808084325167332806e-02,
110 a4 = 7.38555086081402883957e-03,
111 a5 = 2.89051383673415629091e-03,
112 a6 = 1.19270763183362067845e-03,
113 a7 = 5.10069792153511336608e-04,
114 a8 = 2.20862790713908385557e-04,
115 a9 = 1.08011567247583939954e-04,
116 a10 = 2.52144565451257326939e-05,
117 a11 = 4.48640949618915160150e-05,
118 tc = 1.46163214496836224576e+00,
119 tf = -1.21486290535849611461e-01,
121 tt = -3.63867699703950536541e-18,
122 t0 = 4.83836122723810047042e-01,
123 t1 = -1.47587722994593911752e-01,
124 t2 = 6.46249402391333854778e-02,
125 t3 = -3.27885410759859649565e-02,
126 t4 = 1.79706750811820387126e-02,
127 t5 = -1.03142241298341437450e-02,
128 t6 = 6.10053870246291332635e-03,
129 t7 = -3.68452016781138256760e-03,
130 t8 = 2.25964780900612472250e-03,
131 t9 = -1.40346469989232843813e-03,
132 t10 = 8.81081882437654011382e-04,
133 t11 = -5.38595305356740546715e-04,
134 t12 = 3.15632070903625950361e-04,
135 t13 = -3.12754168375120860518e-04,
136 t14 = 3.35529192635519073543e-04,
137 u0 = -7.72156649015328655494e-02,
138 u1 = 6.32827064025093366517e-01,
139 u2 = 1.45492250137234768737e+00,
140 u3 = 9.77717527963372745603e-01,
141 u4 = 2.28963728064692451092e-01,
142 u5 = 1.33810918536787660377e-02,
143 v1 = 2.45597793713041134822e+00,
144 v2 = 2.12848976379893395361e+00,
145 v3 = 7.69285150456672783825e-01,
146 v4 = 1.04222645593369134254e-01,
147 v5 = 3.21709242282423911810e-03,
148 s0 = -7.72156649015328655494e-02,
149 s1 = 2.14982415960608852501e-01,
150 s2 = 3.25778796408930981787e-01,
151 s3 = 1.46350472652464452805e-01,
152 s4 = 2.66422703033638609560e-02,
153 s5 = 1.84028451407337715652e-03,
154 s6 = 3.19475326584100867617e-05,
155 r1 = 1.39200533467621045958e+00,
156 r2 = 7.21935547567138069525e-01,
157 r3 = 1.71933865632803078993e-01,
158 r4 = 1.86459191715652901344e-02,
159 r5 = 7.77942496381893596434e-04,
160 r6 = 7.32668430744625636189e-06,
161 w0 = 4.18938533204672725052e-01,
162 w1 = 8.33333333333329678849e-02,
163 w2 = -2.77777777728775536470e-03,
164 w3 = 7.93650558643019558500e-04,
165 w4 = -5.95187557450339963135e-04,
166 w5 = 8.36339918996282139126e-04,
167 w6 = -1.63092934096575273989e-03;
169 static const double zero= 0.00000000000000000000e+00;
172 double sin_pi(
double x)
180 if(ix<0x3fd00000)
return __kernel_sin(pi*x,zero,0);
190 y = 2.0*(y - floor(y));
196 if(ix<0x43300000) z = y+two52;
204 case 0: y = __kernel_sin(pi*y,zero,0);
break;
206 case 2: y = __kernel_cos(pi*(0.5-y),zero);
break;
208 case 4: y = __kernel_sin(pi*(one-y),zero,0);
break;
210 case 6: y = -__kernel_cos(pi*(y-1.5),zero);
break;
211 default: y = __kernel_sin(pi*(y-2.0),zero,0);
break;
218 __ieee754_lgamma_r(
double x,
int *signgamp)
220 double t,y,z,nadj,p,p1,p2,p3,q,r,w;
224 EXTRACT_WORDS(hx,lx,x);
229 if(ix>=0x7ff00000)
return x*x;
230 if((ix|lx)==0)
return one/zero;
234 return -__ieee754_log(-x);
235 }
else return -__ieee754_log(x);
241 if(t==zero)
return one/zero;
242 nadj = __ieee754_log(pi/fabs(t*x));
243 if(t<zero) *signgamp = -1;
248 if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0;
250 else if(ix<0x40000000) {
252 r = -__ieee754_log(x);
253 if(ix>=0x3FE76944) {y = one-x; i= 0;}
254 else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;}
258 if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;}
259 else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;}
265 p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10))));
266 p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11)))));
268 r += (p-0.5*y);
break;
272 p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12)));
273 p2 = t1+w*(t4+w*(t7+w*(t10+w*t13)));
274 p3 = t2+w*(t5+w*(t8+w*(t11+w*t14)));
275 p = z*p1-(tt-w*(p2+y*p3));
276 r += (tf + p);
break;
278 p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5)))));
279 p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5))));
280 r += (-0.5*y + p1/p2);
283 else if(ix<0x40200000) {
287 p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6))))));
288 q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6)))));
292 case 7: z *= (y+6.0);
293 case 6: z *= (y+5.0);
294 case 5: z *= (y+4.0);
295 case 4: z *= (y+3.0);
296 case 3: z *= (y+2.0);
297 r += __ieee754_log(z);
break;
300 }
else if (ix < 0x43900000) {
301 t = __ieee754_log(x);
304 w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6)))));
305 r = (x-half)*(t-one)+w;
308 r = x*(__ieee754_log(x)-one);
309 if(hx<0) r = nadj - r;