Open In App

TAN() and COT() Function in SQL Server

Last Updated : 06 Oct, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

1. TAN() Function :
The TAN() function returns the tangent of a number.

Syntax :

TAN(number)

Parameter : Required. A numeric value.
number : It is a numeric value.
Returns : It returns the float_expression of the tangent of a number.

Example-1 :
When the arguments holds a positive number.

SELECT TAN(3.25);

Output :

0.10883402551332971



Example-2 :
When the arguments holds a negative number.

SELECT TAN(-3.25);

Output :

-0.10883402551332971



Example-3 :
When the PI() function is the argument.

SELECT TAN(PI());
         OR
DECLARE @angle FLOAT;  
SET @angle = PI();  
SELECT 'The TAN of the angle is: ' + CONVERT(VARCHAR, TAN(@angle)); 

Output :

The TAN of the angle is: -1.22465e-016



Example-4 :
When the argument passing as a expressions.

SELECT TAN(5.2 + 1.4);

Output :

0.32785800671313348


2. COT() Function :
The COT() function returns the cotangent of a number.

Syntax :

COT(number)

Parameter : Required. A numeric value.
number : It is a numeric value.
Returns : It returns the cotangent of a number.

Example-1 :
When the arguments holds a positive number.

SELECT COT(4);

Output :

0.86369115445061673



Example-2 :
When the argument is a fractional component.

SELECT COT(2.53);

Output :

-1.4259392442208509



Example-3 :
When the argument is an expression.

SELECT COT(3 + 1);

Output :

0.86369115445061673

Example-4 :
When the PI() function is the argument.

Select COT(PI());
         OR
DECLARE @angle FLOAT;  
SET @angle = PI();  
SELECT 'The COT of the angle is: ' + CONVERT(VARCHAR, COT(@angle));

Output :

The COT of the angle is: -8.16562e+015

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads