ACOS

Transact-SQL Reference

Transact-SQL Reference

ACOS

Returns the angle, in radians, whose cosine is the given float expression; also called arccosine.

Syntax

ACOS ( float_expression )

Arguments

float_expression

Is an expression of the type float or real, with a value from -1 through 1. Values outside this range return NULL and report a domain error.

Return Types

float

Examples

This example returns the ACOS of the given angle.

SET NOCOUNT OFF
DECLARE @angle float
SET @angle = -1
SELECT 'The ACOS of the angle is: ' + CONVERT(varchar, ACOS(@angle))

Here is the result set:

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

(1 row(s) affected)

This example sets @angle to a value outside the valid range.

SET NOCOUNT OFF
DECLARE @angle float
SET @angle = 1.01
SELECT 'The ACOS of the angle is: ' + CONVERT(varchar, ACOS(@angle))

Here is the result set:

-------------------------------------------------------- 
NULL                        

(1 row(s) affected)

A domain error occurred.

See Also

Mathematical Functions