61 #ifdef POK_NEEDS_LIBMATH
63 #include "math_private.h"
66 __ieee754_hypot(
double x,
double y)
68 double a=x,b=y,t1,t2,yy1,y2,w;
75 if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;}
else {a=x;b=y;}
78 if((ha-hb)>0x3c00000) {
return a+b;}
81 if(ha >= 0x7ff00000) {
85 if(((ha&0xfffff)|low)==0) w = a;
87 if(((hb^0x7ff00000)|low)==0) w = b;
91 ha -= 0x25800000; hb -= 0x25800000; k += 600;
96 if(hb <= 0x000fffff) {
99 if((hb|low)==0)
return a;
101 SET_HIGH_WORD(t1,0x7fd00000);
117 SET_HIGH_WORD(t1,ha);
119 w = __ieee754_sqrt(t1*t1-(b*(-b)-t2*(a+t1)));
123 SET_HIGH_WORD(yy1,hb);
126 SET_HIGH_WORD(t1,ha+0x00100000);
128 w = __ieee754_sqrt(t1*yy1-(w*(-w)-(t1*y2+t2*b)));
133 GET_HIGH_WORD(high,t1);
134 SET_HIGH_WORD(t1,high+(k<<20));