Skip to content

COS ​

Returns the cosine of the argument; the argument is expected to be in radians.

Syntax ​

sql
COS(expr)

Argument ​

expr: An argument as a real number or another data type that can be converted to a numeric data type value representing radians.

Example ​

sql
SELECT 0 as Angle, 0 as expr, cos(0) as "cos(expr)"
UNION ALL 
SELECT 180 as Angle, 3.14 as expr, cos(3.14) as "cos(expr)"
UNION ALL 
SELECT 180 as Angle, 3.14 as expr, cos('3.14') as "cos(expr)" 
UNION ALL 
SELECT 90 as Angle, 1.57 as expr, cos(1.57) as "cos(expr)"
UNION ALL 
SELECT 270 as Angle, 4.71 as expr, cos(4.71) as "cos(expr)";
txt
+---------+----------+-----------+
|  ANGLE  |   EXPR   | cos(expr) |
|---------+----------+-----------|
|       0 |        0 |         1 |
|     180 |     3.14 |       ~-1 |
|     180 |     3.14 |       ~-1 | 
|      90 |     1.57 |        ~0 |
|     270 |     4.71 |        ~0 |
+---------+----------+-----------+