In SQLite, the acos()
function returns the arccosine of a value.
Syntax
acos(x)
Code language: SQL (Structured Query Language) (sql)
Arguments
x
x
is a number, an expression, or a table column that you want to calculate the arccosine.
Return Type
real
The function returns the arccosine of x
in radians. If x
is NULL
, the function returns NULL
.
If x
is a string, the acos()
function will convert the value into a number before calculating the arccosine. If the conversion fails, the acos()
function returns NULL
.
Examples
The following example uses the acos()
function to calculate the arccosine of a value:
SELECT acos(1) result;
Code language: SQL (Structured Query Language) (sql)
Output:
result
------
0.0
Code language: SQL (Structured Query Language) (sql)
The following statement uses the acos()
function to return the arccosine of -1:
SELECT acos(-1) result;
Code language: SQL (Structured Query Language) (sql)
Output:
result
-----------------
3.141592653589793
Code language: SQL (Structured Query Language) (sql)
It returns pi.
Was this tutorial helpful ?