Skip to main content
Version: 2.5

cos

Description

Computes the cosine of the argument.

Syntax

DOUBLE cos(DOUBLE arg)

Parameters

arg: You can specify only a numeric value. This function converts the numeric value into a DOUBLE value before it computes the cosine of the value.

Return value

Returns a value of the DOUBLE data type.

Usage notes

If you specify a non-numeric value, this function returns NULL.

Examples

mysql> select cos(-1);
+--------------------+
| cos(-1) |
+--------------------+
| 0.5403023058681398 |
+--------------------+

mysql> select cos(0);
+--------+
| cos(0) |
+--------+
| 1 |
+--------+

mysql> select cos(1);
+--------------------+
| cos(1) |
+--------------------+
| 0.5403023058681398 |
+--------------------+

mysql> select cos("");
+---------+
| cos('') |
+---------+
| NULL |
+---------+

keyword

COS