Skip to main content

ACOS

A scalar numeric function that returns the arc-cosine, in radians, of a given cosine.

Synopsis

{fn ACOS(float-expression)}

Arguments

Argument Description
float-expression An expression of type float or real, whose value is between -1 and 1. This is the cosine of the angle.

Description

ACOS takes a numeric value and returns the inverse (arc) of its cosine as a floating point number. The value of float-expression must be a signed decimal number ranging from 1 to -1 (inclusive). A number outside of this range causes a runtime error, generating an SQLCODE -400 (fatal error occurred). ACOS returns NULL if passed a NULL value. ACOS treats nonnumeric strings, including the empty string (''), as the numeric value 0.

ACOS returns a value of data type FLOAT with a precision of 19 and a scale of 18.

ACOS can only be used as an ODBC scalar function (with the curly brace syntax).

You can use the DEGREES function to convert radians to degrees. You can use the RADIANS function to convert degrees to radians.

Examples

The following examples show the effect of ACOS on two cosines:

SELECT {fn ACOS(0.52)} AS ArcCosine 

returns 1.023945...

SELECT {fn ACOS(-1)} AS ArcCosine

returns pi (3.14159...).

See Also

FeedbackOpens in a new tab