ACOS (Transact-SQL)

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2008)yesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

A mathematical function that returns the angle, in radians, whose cosine is the specified float expression; also called arccosine.

Topic link icon Transact-SQL Syntax Conventions

Syntax

-- Syntax for SQL Server, Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse  

ACOS ( float_expression )  

Arguments

float_expression
Is an expression of the type float or of a type that can be implicitly converted to float, with a value from -1 through 1. Values outside this range return NULL and report a domain error.

Return Types

float

Examples

The following example returns the ACOS of the specified number.

SET NOCOUNT OFF;  
DECLARE @cos float;  
SET @cos = -1.0;  
SELECT 'The ACOS of the number is: ' + CONVERT(varchar, ACOS(@cos));  

Here is the result set.

---------------------------------   
The ACOS of the number is: 3.14159   

(1 row(s) affected)  

Examples: Azure SQL Data Warehouse and Parallel Data Warehouse

The following example returns the ACOS of the specified number.

DECLARE @cos float;  
SET @cos = -1.0;  
SELECT 'The ACOS of the number is: ' + CONVERT(varchar, ACOS(@cos));  

Here is the result set.

---------------------------------   
The ACOS of the number is: 3.14159   

(1 row(s) affected)  

See Also

Mathematical Functions (Transact-SQL)
Functions