Menu

SQL Server TAN() Function

Updated on

TAN() returns the tangent of a float expression interpreted as an angle in radians. The return type is float. See Microsoft’s TAN() reference.

Syntax

TAN(float_expression)

float_expression must be float or a type SQL Server can implicitly convert to float.

Usage

The TAN() function can be used for various mathematical calculations and analyses, such as computing the tangent value of an angle in trigonometry.

Examples

Example 1

Return the tangent value of an angle of 45 degrees.

SELECT TAN(RADIANS(CONVERT(float, 45))) AS TanValue;

Result:

TanValue
1.000000

Example 2: Pass an angle already in radians

SELECT TAN(0.45) AS TanValue;

Result (rounded for display):

TanValue
0.48

Conclusion

TAN() expects radians, not degrees. Convert integer degree values to float before using RADIANS(), because that function’s return type follows its input type. For the cotangent, see COT().