SQL ACOS Function

Savigo
You organize your data. Now organize your savings.
Set savings goals, track your progress, and stay on course.
Get Savigo for iPhone 

The SQL ACOS function calculates the arc cosine of a numeric expression that evaluates a float value between -1 and 1.

In math, the arccosine(x) is defined as the inverse cosine(x) when -1≤x≤1.

Syntax #

The following shows the syntax of the ACOS function.

ACOS(numeric_expression)

Argument #

The ACOS function accepts a numeric_expression that evaluates to a float value in the range -1 and 1.

Return Type #

The ACOS function returns a floating-point number in radians.

Examples #

The following example returns the arc cosine of 0.5

SELECT ACOS(0.5);

Try it

Output:

      acos
-----------------
 1.0471975511966
(1 row)

To see the degrees value, you use the DEGREES function:

SELECT DEGREES(ACOS(0.5));

Try it

Output:

 degrees
---------
      60
(1 row)

Most database systems support the ACOS function with the same behavior.

Was this helpful?