ATAN2
All functions > MATH > ATAN2
Returns the arctangent of y/x, using the signs to determine the quadrant.
Syntax
ATAN2(y, x) sql
Arguments
| Parameter | Type | Required | Description |
|---|---|---|---|
y | DOUBLE | Yes | The y-coordinate (numerator) |
x | DOUBLE | Yes | The 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