SQL Server ACOS() Function

The ACOS() function in SQL Server calculates the arccosine (inverse cosine) of a number. The arccosine is the angle whose cosine is the specified number. The result is given in radians.



ACOS(): Definition and Usage

This is a mathematical function primarily used in applications involving trigonometry and geometry. It's the inverse operation of the COS() function. Remember that the input value (the number whose arccosine you're finding) must be within the range of -1 to +1; otherwise, the function returns NULL.

Syntax

Syntax

ACOS(number)
      

Parameter Values

Parameter Description
number The numeric value (must be between -1 and 1) for which you want to find the arccosine. The result will be in radians. This is required.

Examples

Calculating the Arccosine of a Positive Number

This example calculates the arccosine of 0.25.

Syntax

SELECT ACOS(0.25);
      
Output

1.3181160716528 (The exact value may vary slightly depending on your SQL Server version)
      

Calculating the Arccosine of a Negative Number

This example calculates the arccosine of -0.8.

Syntax

SELECT ACOS(-0.8);
      
Output

2.49809154478799 (The exact value may vary slightly depending on your SQL Server version)
      

Technical Details

The ACOS() function is available in:

  • SQL Server (starting with version 2008)
  • Azure SQL Database
  • Azure SQL Data Warehouse
  • Parallel Data Warehouse