ATAN2

All functions > MATH > ATAN2

Returns the arctangent of y/x, using the signs to determine the quadrant.

Syntax

ATAN2(y, x)
sql

Arguments

ParameterTypeRequiredDescription
yDOUBLEYesThe y-coordinate (numerator)
xDOUBLEYesThe x-coordinate (denominator)

Returns

DOUBLE - Arctangent in radians (between -π and π)

Notes

  • Returns the angle from the positive x-axis to point (x, y)
  • Uses signs of both arguments to determine the correct quadrant
  • Returns values in the range (-π, π] radians
  • ATAN2(0, 1) = 0, ATAN2(1, 0) = π/2, ATAN2(0, -1) = π
  • More accurate than ATAN(y/x) for points near axes
  • Returns NULL if either input is NULL

Examples

Last update at: 2025/10/13 10:23:46