Skip to content

atan2

Four-quadrant arctangent.

C = atan2(Y, X)

Returns the angle from the positive x-axis to the point (X, Y), in radians, in the range (-π, π]. Resolves the quadrant ambiguity that atan(Y/X) cannot.

atan2(1, 1) % π/4
atan2(1, -1) % 3π/4 (resolved correctly to upper-left)
  • atan2d — Four-quadrant arctangent in degrees.
  • atan — Inverse tangent (radians).
  • hypot — Square root of sum of squares (numerically stable).