MariaDB COS() Function

In MariaDB, COS() is a built-in numeric function that returns the cosine of a given radian.

MariaDB COS() Syntax

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

COS(number)

Parameters

number

Required. A radian value used to calculate the cosine.

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 'COS'.

Return value

The MariaDB COS() function returns the cosine of the specified radian value.

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

MariaDB COS() Examples

Here is an example:

SELECT
    COS(2.5),
    COS(0.2),
    COS(-0.5),
    COS(-0.2),
    COS(0),
    COS(PI()),
    COS(NULL)\G

Output:

 COS(2.5): -0.8011436155469337
 COS(0.2): 0.9800665778412416
COS(-0.5): 0.8775825618903728
COS(-0.2): 0.9800665778412416
   COS(0): 1
COS(PI()): -1
COS(NULL): NULL

Conclusion

In MariaDB, COS() is a built-in numeric function that returns the cosine of a given radian.