PostgreSQL acosd() Function

The PostgreSQL acosd() function returns the arc cosine of the specified number in degrees.

acosd() Syntax

This is the syntax of the PostgreSQL acosd() function:

acosd(number)

acosd(number) is equivalent to degrees(acos(number)).

Parameters

number

Required. The number used to calculate the arc cosine. It should be between -1 and 1, inclusive.

Return value

The PostgreSQL acosd() function returns the arc cosine of the specified number in degrees.

If the argument number is not between -1 and 1, the acosd() function will throw an error.

If the parameter number is NULL, the acosd() function will return NULL.

acosd() Examples

Here are a few examples of the acosd() function:

SELECT
    acosd(-1) AS "acosd(-1)",
    acosd(-0.5) AS "acosd(-0.5)",
    acosd(-0.2) AS "acosd(-0.2)",
    acosd(0) AS "acosd(0)",
    acosd(0.2) AS "acosd(0.2)",
    acosd(0.5) AS "acosd(0.5)",
    acosd(1) AS "acosd(1)";
-[ RECORD 1 ]-------------------
acosd(-1)   | 180
acosd(-0.5) | 120
acosd(-0.2) | 101.53695903281549
acosd(0)    | 90
acosd(0.2)  | 78.46304096718451
acosd(0.5)  | 60
acosd(1)    | 0

acosd(number) is equivalent to converting the result of acos(number) to degrees using the degrees() function, for example:

SELECT
    acosd(-1) AS "acosd(-1)",
    degrees(acos(-1)) AS "degrees(acos(-1))";
-[ RECORD 1 ]-----+----
acosd(-1)         | 180
degrees(acos(-1)) | 180