56 #ifdef POK_NEEDS_LIBMATH
58 #include "math_private.h"
63 pi_o_4 = 7.8539816339744827900E-01,
64 pi_o_2 = 1.5707963267948965580E+00,
65 pi = 3.1415926535897931160E+00,
66 pi_lo = 1.2246467991473531772E-16;
69 __ieee754_atan2(
double y,
double x)
72 int32_t k,m,hx,hy,ix,iy;
75 EXTRACT_WORDS(hx,lx,x);
77 EXTRACT_WORDS(hy,ly,y);
79 if(((ix|((lx|-lx)>>31))>0x7ff00000)||
80 ((iy|((ly|-ly)>>31))>0x7ff00000))
82 if(((hx-0x3ff00000)|lx)==0)
return atan(y);
83 m = ((hy>>31)&1)|((hx>>30)&2);
90 case 2:
return pi+tiny;
91 case 3:
return -pi-tiny;
95 if((ix|lx)==0)
return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
101 case 0:
return pi_o_4+tiny;
102 case 1:
return -pi_o_4-tiny;
103 case 2:
return 3.0*pi_o_4+tiny;
104 case 3:
return -3.0*pi_o_4-tiny;
108 case 0:
return zero ;
109 case 1:
return -zero ;
110 case 2:
return pi+tiny ;
111 case 3:
return -pi-tiny ;
116 if(iy==0x7ff00000)
return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
120 if(k > 60) z=pi_o_2+0.5*pi_lo;
121 else if(hx<0&&k<-60) z=0.0;
122 else z=atan(fabs(y/x));
128 SET_HIGH_WORD(z,zh ^ 0x80000000);
131 case 2:
return pi-(z-pi_lo);