55 #ifdef POK_NEEDS_LIBMATH
57 #include "namespace.h"
58 #include "math_private.h"
62 invsqrtpi= 5.64189583547756279280e-01,
63 two = 2.00000000000000000000e+00,
64 one = 1.00000000000000000000e+00;
66 static const double zero = 0.00000000000000000000e+00;
69 __ieee754_jn(
int n,
double x)
71 int32_t i,hx,ix,lx, sgn;
72 double a, b, temp, di;
79 EXTRACT_WORDS(hx,lx,x);
82 if((ix|((uint32_t)(lx|-lx))>>31)>0x7ff00000)
return x+x;
88 if(n==0)
return(__ieee754_j0(x));
89 if(n==1)
return(__ieee754_j1(x));
92 if((ix|lx)==0||ix>=0x7ff00000)
94 else if((
double)n<=x) {
111 case 0: temp = cos(x)+sin(x);
break;
112 case 1: temp = -cos(x)+sin(x);
break;
113 case 2: temp = -cos(x)-sin(x);
break;
114 case 3: temp = cos(x)-sin(x);
break;
116 b = invsqrtpi*temp/sqrt(x);
122 b = b*((double)(i+i)/x) - a;
134 temp = x*0.5; b = temp;
135 for (a=one,i=2;i<=n;i++) {
172 double q0,q1,h,tmp; int32_t k,m;
173 w = (n+n)/(
double)x; h = 2.0/(double)x;
174 q0 = w; z = w+h; q1 = w*z - 1.0; k=1;
182 for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t);
195 tmp = tmp*__ieee754_log(fabs(v*tmp));
196 if(tmp<7.09782712893383973096e+02) {
197 for(i=n-1,di=(
double)(i+i);i>0;i--){
205 for(i=n-1,di=(
double)(i+i);i>0;i--){
219 b = (t*__ieee754_j0(x)/b);
222 if(sgn==1)
return -b;
else return b;
226 __ieee754_yn(
int n,
double x)
233 EXTRACT_WORDS(hx,lx,x);
236 if((ix|((uint32_t)(lx|-lx))>>31)>0x7ff00000)
return x+x;
237 if((ix|lx)==0)
return -one/zero;
238 if(hx<0)
return zero/zero;
242 sign = 1 - ((n&1)<<1);
244 if(n==0)
return(__ieee754_y0(x));
245 if(n==1)
return(sign*__ieee754_y1(x));
246 if(ix==0x7ff00000)
return zero;
262 case 0: temp = sin(x)-cos(x);
break;
263 case 1: temp = -sin(x)-cos(x);
break;
264 case 2: temp = -sin(x)+cos(x);
break;
265 case 3: temp = sin(x)+cos(x);
break;
267 b = invsqrtpi*temp/sqrt(x);
273 GET_HIGH_WORD(high,b);
274 for(i=1;i<n&&high!=0xfff00000;i++){
276 b = ((double)(i+i)/x)*b - a;
277 GET_HIGH_WORD(high,b);
281 if(sign>0)
return b;
else return -b;