What is ACOS() in SQL?

The ACOS() functionalso called the arc cosine function returns the inverse cosine of a number. To be more specific, it returns the inverse cosine of a number in the radian float value.

Figure 1 shows the mathematical representation of the ACOS() function and Figure 2 shows the visual representation of the ACOS() function.

Figure 1: Mathematical representation of inverse cosine function
Figure 2: Visual representation of inverse cosine function

Syntax

ACOS(number)

Parameter

This function requires a number as a parameter. The parameter must be a float value between -1 and 1, i.e., -1 <= parameter <= 1.

Return Value

ACOS() returns the inverse cosine of a number (radian float value) that is sent as a parameter. If the parameter is not between -1 and 1, it returns NULL.

Example

/*example showing how to use ACOS(X)*/
-- positive number
select ACOS(1);
-- negative number
select ACOS(-1);
-- fractional number
select ACOS(0.6);
-- not between -1 and 1
select ACOS(3);
select ACOS(-3);

Free Resources