TAN() and COT() Function in SQL Server

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
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.