MySQL - ATAN() Function



MySQL provides a set of mathematical functions to perform various numerical operations. The ATAN() function of MySQL is one such mathematical function that is used to find the arc tangent value of a number.

A tangent function in trigonometry is generally defined as the ratio of the sine function to the cosine function; the arc tangent function is its inverse, where the domain of tangent function becomes the range of arc tangent function and vice-versa.

This function accepts an integer number as an argument and returns the arc tangent value for the given integer.

Syntax

Following is the syntax of ATAN() function in MySQL −

ATAN(x)

Parameters

This function takes an integer value between 1 and -1 as a parameter.

Return Value

This function returns the angle in radians of the given tan value.

Example

The following query uses the MySQL ATAN() function to calculate the arctangent of the value 0.8 −

SELECT ATAN(0.8) As Result;

Output

The output for the query above is produced as given below −

Result
0.6747409422235527

Example

You can also pass negative value to this function as shown below −

SELECT ATAN(-0.5) As Result;

Output

This will produce the following result −

Result
-0.4636476090008061

Example

In the following example, we are calculating the arctangent of the value 6 −

SELECT ATAN(6) As Result;

Output

This will produce the following result −

Result
1.4056476493802699

Example

The below query calculates the arctangent of the value 0 −

SELECT ATAN(0) As Result;

Output

This will produce the following result −

Result
0

Example

The tangent value of the result (of atan function) will be equal to the given value −

SELECT ATAN(1) As Result;

This will produce the following result −

Result
0.7853981633974483
SELECT TAN(0.7853981633974483) As Result;

On executing the given query, the output is displayed as follows −

Result
0.9999999999999999
Advertisements