title: Basic trig: math.atan() issue
body: <p>I'm having a little trouble with some basic trig. I'm doing some math homework, and I finally got bored of converting rectangular coordinates to polar coordinates and vice versa, so I decided to whip up a little Python program to help me with the conversions. However, Math.atan() is giving me a little trouble. Here's the code:</p>
  
  <pre><code>def rect_to_polar_input(x, y):
      hypotenuse = math.sqrt((x * x) + (y * y))
      tangent = float(y / x);
      angle = round(math.degrees(math.atan(tangent)));
  
      if x &lt;= 0:
          if(y &gt;=0):
              angle += 90
  
          if(y &lt;= 0):
              angle+= 180
  
      if x &gt;= 0:
          if(y&lt;0):
              angle+=270
  
      return hypotenuse, angle
  </code></pre>
  
  <p>In case you're wondering why I have those clunky <code>if</code> statements in there, it's to add the correct angle for the quadrant the rectangular coordinates are in. Quadrant 2 is 90 degrees away from Quadrant 1, and Quadrant 3 is 180 degrees from Quadrant 1, etc.</p>
  
  <p>Now, if I enter a value like <code>(5, 5)</code>, everything works as expected. However, if I enter <code>(-5, 5)</code>, I get a value of <code>7.07, 45</code>, where I should be getting <code>7.07, 135</code>. If I enter <code>(-5, -5)</code>, I get a value of <code>7.07, 225</code>, which is expected. Finally, if I enter a value of <code>(5, -5)</code>, I still get a value of <code>7.07, 225</code>. I've tried everything I can think of, but it's not working. So, what am I missing?</p>