ATAN2()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the arc tangent angle based on the length of the opposite and adjacent sides.
USAGE
ATAN2(opposite_length, adjacent_length)
ATAN2(ratio)
Argument Name | Description |
---|---|
| The lengths of the triangle's opposite sides |
| The lengths of the triangle's adjacent sides |
| The tangent slope's ratio |
DETAILS
ATAN2()
is a trigonometric function that returns the arc tangent angle (in radians) based on the length of a triangle's opposite and adjacent sides.
When two arguments are supplied, the returned angle can be in any quadrant since it knows which lengths are positive and which are negative. The units used to measure the lengths don't matter as long as the same units are used in both measurements.
When one argument is supplied, it behaves as an alias for ATAN() and only returns angles in quadrants I and IV.
A NULL
is returned if either of the arguments is NULL
.
EXAMPLES
SELECT ATAN2(-10, -5), ATAN2(2);
+------------------+-----------------+
| ATAN2(-10, -5) | ATAN2(2) |
+------------------+-----------------+
| -2.0344439357957 | 1.1071487177941 |
+------------------+-----------------+
SELECT ATAN2(-1, 1);
+-------------------+
| ATAN2(-1, 1) |
+-------------------+
| -0.78539816339745 |
+-------------------+