SIN() and COS() Function in SQL Server
1. SIN() Function :
The SIN() function returns the sine of a number.
Syntax :
SIN(number)
Parameter : Required. A numeric value.
number : It is a numeric value.
Returns : It returns the float_expression of the sine of a number.
Example-1 :
When the argument holds a positive number.
SELECT SIN(5);
Output :
-0.95892427466313845
Example-2 :
When the argument holds a negative number.
SELECT SIN(-5);
Output :
0.95892427466313845
Example-3 :
When the PI() function is the argument.
SELECT SIN(PI());
Output :
1.2246467991473532E-16
Example-4 :
When the argument passed is an expression.
SELECT SIN(4 * 3);
Output :
-0.53657291800043494
2. COS() Function
The COS() function returns the cosine of a number.
Syntax :
COS(number)
Parameter : Required. A numeric value.
number : It is a numeric value.
Returns : It returns the cosine of a number.
Example-1 :
When the argument holds a positive number.
SELECT COS(4);
Output :
-0.65364362086361194
Example-2 :
When the argument is a fractional component.
SELECT COS(2.53);
Output :
-0.81873459927738157
Example-3 :
When the PI() function is the argument.
SELECT COS(PI());
Output :
-1