Mysql Atan2 Function

MySQL: ATAN2 Function

This tutorial explains how to use the MySQL ATAN2 function with syntax and examples.


The MySQL ATAN2 function returns the arc tangent of n and m.


The syntax for the ATAN2 function in MySQL is:

ATAN2( n, m )

Parameters or Arguments

n, m

Values used to calculate the arc tangent of two values.


  • The signs of n and m are used to determine the quadrant for the result from the ATAN2 function.

Applies To

The ATAN2 function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23


Let's look at some MySQL ATAN2 function examples and explore how to use the ATAN2 function in MySQL.

For example:

mysql> SELECT ATAN2(0.75, 1);
Output: 0.6435011087932844

mysql> SELECT ATAN2(-0.9, 2);
Output: -0.4228539261329407

mysql> SELECT ATAN2(PI(), 2);
Output: 1.0038848218538872