title: Perl atan2 values out of range
body: <p>I'm trying to compute the angle of an AB Segment with the horizontal axis using the atan2() in Perl. The Perl documantation says </p>
  
  <blockquote>
    <p>atan2 Y,X
    Returns the arctangent of Y/X in the range -PI to PI.</p>
  </blockquote>
  
  <p>The following subroutine:   </p>
  
  <pre><code>sub computeAngle($$$$){
  my($x1_, $y1_, $x2_, $y2_) = @_;
  $result  = 0;
  
  $result = atan2($y2_-$y1_, $x2_-$x1_)*360/3.14159265359;
  
  print " Angle= $result°\n";
  return $result;
  }
  </code></pre>
  
  <p>Produces values outside of the interval:</p>
  
  <p>0 0 -30.7933862796053 216.100103110075  Angle= 196.219639131902°</p>
  
  <p>0 0 -81.245545537211 -11.7299860790372  Angle= -343.569155014717°</p>
  
  <p>Why is this happening?</p>