MySQL - TAN() Function



The MySQL TAN() function calculates the trigonometric tangent of the given angle.

The tangent of an angle is defined as the ratio of the opposite side of the given angle to the adjacent side of the given angle in a right-angled triangle. This method expects a value to be passed as an argument in radians.

This function accepts an integer value (in radians) as a parameter and returns the tangent value.

Syntax

Following is the syntax of MySQL TAN() function −

TAN(x);

Parameters

This function takes an integer value in radians as a parameter.

Return Value

This function returns the tangent of the given angle as a numeric value.

Example

In the following query, we are using the MySQL TAN() function to calculate the tangent of the angle 8 (in radians) −

SELECT TAN(8) As Result;

Output

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

Result
-6.799711455220379

Example

We can also pass PI() function as a value to this function as shown below. The value of PI() function is 3.14 −

SELECT TAN(PI()) As Result;

Output

This will produce the following result −

Result
-1.2246467991473532e-16

Example

Following is another example of this function −

SELECT TAN(-16) As Result;

Output

This will produce the following result −

Result
-0.3006322420239034

Example

Here, we are calculating the tangent of the angle 0 −

SELECT TAN(0) As Result;

Output

The tangent value for 0 is 0 −

Result
0
Advertisements