w3resource
MYSQL Tutorial

MySQL ATAN2() function

ATAN2() function

MySQL ATAN2() returns the arc tangent of two numbers for a point on a Cartesian plane.The reverse function is TAN().

Syntax:

ATAN2(num1, num2);

Arguments

Name Description
num1 A number.
num2 A number.

Syntax Diagram:

MySQL ATAN2() Function - Syntax Diagram

MySQL Version: 5.6


Example

Code:

SELECT ATAN2(-3,2);

Explanation

The above MySQL statement will return the arc tangent in radians of -3 and 2 for a point in a Cartesian plane.

Sample Output:

mysql> SELECT ATAN2(-3,2);
+--------------------+
| ATAN2(-3,2)        |
+--------------------+
| -0.982793723247329 | 
+--------------------+
1 row in set (0.01 sec)

All Mathematical Functions

MySQL Mathematical Functions, slide presentation

Previous: ASIN()
Next: ATAN()