MySQL TAN() Function

The TAN() function in MySQL calculates the trigonometric tangent of an angle. The input to the function is the angle in radians, and the output is the tangent of that angle.



TAN(): Definition and Usage

The tangent function (tan) is a fundamental trigonometric function frequently used in various mathematical, scientific, and engineering calculations involving angles and triangles. The TAN() function in MySQL provides a convenient way to perform this computation directly within your SQL queries. The input is an angle in radians, and the output is the tangent of that angle.

Syntax

Syntax

TAN(number)
      

Parameter Values

Parameter Description
number The angle in radians. This is required and must be a numeric value.

Examples

Calculating the Tangent of a Positive Number

This example calculates the tangent of 1.75 radians.

Syntax

SELECT TAN(1.75);
      
Output

-1.02963856809667
      

Calculating the Tangent of a Negative Number

This example demonstrates calculating the tangent of -3 radians.

Syntax

SELECT TAN(-3);
      
Output

0.142546543074278
      

**Note:** The output values are approximate due to the nature of floating-point numbers and may vary slightly depending on your MySQL version. The input value represents the angle in *radians*. To convert from degrees to radians, you can use the `RADIANS()` function. If you input a value that results in an undefined tangent (like multiples of 90 degrees), you will receive an error.