w3resource
MYSQL Tutorial

MySQL ATAN() function

ATAN() function

MySQL ATAN() returns the arc tangent of a number.

Syntax:

ATAN(N);

Argument

Name Description
N A number whose arc tangent value is to be retrieved.

Alternate Syntax

ATAN(N2,N1);

Argument

Argument Description
N1 A number.
N2 A number.

Note: ATAN(N1,N2) is similar to calculating the arc tangent of N2 / N1,

Syntax Diagram:

MySQL ATAN() Function - Syntax Diagram

MySQL Version: 5.6


Example:

Code:

SELECT ATAN(4);

Explanation

The above MySQL statement will return the arc tangent value of the number specified as an argument.

Sample Output:

mysql> SELECT ATAN(4);
+------------------+
| ATAN(4)          |
+------------------+
| 1.32581766366803 | 
+------------------+
1 row in set (0.02 sec)

Example : ATAN() function using negative value

Code:

SELECT ATAN(-4);

Explanation

This statement above will return the arc tangent value of the number defined as an argument.

Sample Output:

mysql> SELECT ATAN(-4);
+-------------------+
| ATAN(-4)          |
+-------------------+
| -1.32581766366803 | 
+-------------------+
1 row in set (0.00 sec)

Example : ATAN() function using a division

Code:

SELECT ATAN(3,2);

Explanation

This statement above will return the arc tangent value of the numbers (i.e. 3 and 2) defined as arguments. Since two arguments are passed, it is similar to calculate the arc tangent of 3 / 2.

Sample Output:

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

All Mathematical Functions

MySQL Mathematical Functions, slide presentation

Previous: ATAN2()
Next: CEIL()