In MariaDB, ACOS() is a built-in numeric function that returns the arccosine (inverse cosine) of its argument.
In other words, it returns the value whose cosine is the argument.
Syntax
The syntax goes like this:
ACOS(X)
Where X is a valid expression that resolves to a number between -1 and 1.
Example
Here’s an example:
SELECT ACOS(0.32);
Result:
+--------------------+ | ACOS(0.32) | +--------------------+ | 1.2450668395002664 | +--------------------+
Here are some more examples:
SELECT
ACOS(0),
ACOS(-1),
ACOS(1);
Result:
+--------------------+-------------------+---------+ | ACOS(0) | ACOS(-1) | ACOS(1) | +--------------------+-------------------+---------+ | 1.5707963267948966 | 3.141592653589793 | 0 | +--------------------+-------------------+---------+
Out of Range Argument
The argument must be between -1 and 1. If not, null is returned.
Example:
SELECT ACOS(2);
Result:
+---------+ | ACOS(2) | +---------+ | NULL | +---------+
Missing Argument
Calling ACOS() without an argument results in an error:
SELECT ACOS();
Result:
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'ACOS'