23 static const double one = 1.0, Zero[] = {0.0, -0.0,};
25 static double one = 1.0, Zero[] = {0.0, -0.0,};
35 int n,hx,hy,hz,ix,iy,sx,i;
47 if((hy|ly)==0||(hx>=0x7ff00000)||
48 ((hy|((ly|-ly)>>31))>0x7ff00000))
51 if((hx<hy)||(lx<ly))
return x;
53 return Zero[(unsigned)sx>>31];
59 for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
61 for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1;
63 }
else ix = (hx>>20)-1023;
68 for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
70 for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1;
72 }
else iy = (hy>>20)-1023;
76 hx = 0x00100000|(0x000fffff&hx);
80 hx = (hx<<n)|(lx>>(32-n));
88 hy = 0x00100000|(0x000fffff&hy);
92 hy = (hy<<n)|(ly>>(32-n));
103 hz=hx-hy;lz=lx-ly;
if(lx<ly) hz -= 1;
104 if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;}
107 return Zero[(
unsigned)sx>>31];
108 hx = hz+hz+(lz>>31); lx = lz+lz;
111 hz=hx-hy;lz=lx-ly;
if(lx<ly) hz -= 1;
112 if(hz>=0) {hx=hz;lx=lz;}
116 return Zero[(
unsigned)sx>>31];
117 while(hx<0x00100000) {
118 hx = hx+hx+(lx>>31); lx = lx+lx;
122 hx = ((hx-0x00100000)|((iy+1023)<<20));
128 lx = (lx>>n)|((
unsigned)hx<<(32-n));
131 lx = (hx<<(32-n))|(lx>>n); hx = sx;
133 lx = hx>>(n-32); hx = sx;