Evidently you feel more comfortable using degrees rather than radians but the conversion to and from radians<->degrees serves no real purpose. Just define:
my $ninety_degrees = atan(1)*2;
You will get a division by zero crash in the case where $x and $y = 0 as it will fall through your 'extreme cases'. You can remove the dependency on a module by using radians and using a function for atan() like:
sub atan {
return 0 if $_[0]==0;
return $_[0] > 0 ?
atan2(sqrt(1+$_[0]*$_[0]),sqrt(1+1/($_[0]*$_[0]))) :
-atan2(sqrt(1+$_[0]*$_[0]),sqrt(1+1/($_[0]*$_[0])));
}