58 static const double PIo2[] = {
59 1.57079625129699707031e+00,
60 7.54978941586159635335e-08,
61 5.39030252995776476554e-15,
62 3.28200341580791294123e-22,
63 1.27065575308067607349e-29,
64 1.22933308981111328932e-36,
65 2.73370053816464559624e-44,
66 2.16741683877804819444e-51,
72 two24 = 1.67772160000000000000e+07,
186 int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
187 double z,fw,f[20],fq[20],q[20];
202 for(i=0; i<=m; i++,j++) f[i] = (j<0)?
zero : (
double) ipio2[j];
205 for (i=0; i<=jk; i++) {
206 for(j=0,fw=0.0; j<=jx; j++) fw += x[j]*f[jx+i-j];
213 for(i=0,j=jz,z=q[jz]; j>0; i++,j--) {
214 fw = (
double)((
int)(
twon24* z));
215 iq[i] = (
int)(z-
two24*fw);
226 i = (iq[jz-1]>>(24-q0));
228 iq[jz-1] -= i<<(24-q0);
229 ih = iq[jz-1]>>(23-q0);
231 else if(q0==0) ih = iq[jz-1]>>23;
232 else if(z>=0.5) ih=2;
237 for(i=0; i<jz ; i++) {
242 iq[i] = 0x1000000- j;
244 }
else iq[i] = 0xffffff - j;
249 iq[jz-1] &= 0x7fffff;
252 iq[jz-1] &= 0x3fffff;
265 for (i=jz-1; i>=jk; i--) j |= iq[i];
267 for(k=1; iq[jk-k]==0; k++);
269 for(i=jz+1; i<=jz+k; i++) {
270 f[jx+i] = (
double) ipio2[jv+i];
271 for(j=0,fw=0.0; j<=jx; j++) fw += x[j]*f[jx+i-j];
290 fw = (
double)((
int)(
twon24*z));
291 iq[jz] = (
int)(z-
two24*fw);
295 }
else iq[jz] = (
int) z ;
300 for(i=jz; i>=0; i--) {
301 q[i] = fw*(
double)iq[i];
306 for(i=jz; i>=0; i--) {
307 for(fw=0.0,k=0; k<=jp&&k<=jz-i; k++) fw +=
PIo2[k]*q[i+k];
315 for (i=jz; i>=0; i--) fw += fq[i];
316 y[0] = (ih==0)? fw: -fw;
321 for (i=jz; i>=0; i--) fw += fq[i];
322 y[0] = (ih==0)? fw: -fw;
324 for (i=1; i<=jz; i++) fw += fq[i];
325 y[1] = (ih==0)? fw: -fw;
328 for (i=jz; i>0; i--) {
333 for (i=jz; i>1; i--) {
338 for (fw=0.0,i=jz; i>=2; i--) fw += fq[i];
double scalbn(double x, int32_t n)
static const double two24
double floor(double x)
Floor function.
static const double twon24
static const int init_jk[]
static const double PIo2[]
int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2)
Kernel reduction function.