MariaDB ACOS() Function

In MariaDB, ACOS() is a built-in numeric function that returns the arccosine of a given number.

MariaDB ACOS() Syntax

Here is the syntax of the MariaDB ACOS() function:

ACOS(number)

Parameters

number

Required. A numeric value used to compute the arccosine. It should be between -1 and 1.

If you provide the wrong number of parameters, MariaDB will report an error: ERROR 1582 (42000): Incorrect parameter count in the call to native function 'ACOS'.

Return value

The MariaDB ACOS() function returns the arccosine of the specified number.

If the parameter is number not between-1 and 1, the ACOS() function will return NULL.

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

MariaDB ACOS() Examples

The following statement shows the basic usage of the MariaDB ACOS() function:

SELECT
    ACOS(0.5),
    ACOS(0.2),
    ACOS(-0.5),
    ACOS(-0.2),
    ACOS(1),
    ACOS(0),
    ACOS(-1),
    ACOS(2),
    ACOS(-2),
    ACOS(NULL)\G

Output:

 ACOS(0.5): 1.0471975511965979
 ACOS(0.2): 1.369438406004566
ACOS(-0.5): 2.0943951023931957
ACOS(-0.2): 1.7721542475852274
   ACOS(1): 0
   ACOS(0): 1.5707963267948966
  ACOS(-1): 3.141592653589793
   ACOS(2): NULL
  ACOS(-2): NULL
ACOS(NULL): NULL

Conclusion

In MariaDB, ACOS() is a built-in numeric function that returns the arccosine of a given number.