ACOS() Function in SQL Server
ACOS() function :
This function in SQL Server is used to return the arc cosine or the inverse cosine of a specified value. Input to the arc-cosine function should must be in between -1 and 1 (inclusive), otherwise this function returns NULL.
Features :
- This function is used to find the arc cosine or the inverse cosine of a specified value.
- This function accepts a single parameter.
- The range of accepted parameter is in between -1 and 1 (inclusive), otherwise this function returns NULL.
- The returned value will be in radians.
Syntax :
SELECT ACOS(number);
Parameter :
This method accepts a parameter as given below:
- number: Specified numeric value whose inverse cosine is going to be returned.
Returns :
It returns the arc cosine or the inverse cosine of a specified value.
Example-1 :
Getting the inverse cosine of a specified value -1
SELECT ACOS(-1);
Output :
3.1415926535897931
Example-2 :
Getting the inverse cosine of a specified value 1
SELECT ACOS(1);
Output :
0.0
Example-3 :
Using ACOS() function with a variable and getting the inverse cosine of a specified value 0.
DECLARE @Parameter_Value INT; SET @Parameter_Value = 0; SELECT ACOS(@Parameter_Value);
Output :
1.5707963267948966
Example-4 :
Using ACOS() function with a variable and Getting the inverse cosine of a specified float value “0.45”.
DECLARE @Parameter_Value float; SET @Parameter_Value = 0.45; SELECT ACOS(@Parameter_Value);
Output :
1.1040309877476002
Application :
This function is used to return the arc cosine or the inverse cosine of a specified value.