function phi=atn2(y,x)
% function phi=atn2(y,x)
%
% arcus Tangens from (y/x) for two arguments
% algorithms by Montenbruck/Pfleger: "Astronomy with the Personal Computer"
%
% 05.05.04 M.Penzkofer
rho = pi/180;
if (x == 0.0 & y == 0.0)
phi = 0.0;
else
AX=abs(x);
AY=abs(y);
if (AX > AY)
phi=atan(AY/AX)/rho;
else
phi=90.0-atan(AX/AY)/rho;
end
if (x < 0.0)
phi=180.0-phi;
end
if (y < 0.0)
phi=-phi;
end
end