Skip to main content

COT

Description

Returns the cotangent of x, where x is the value in radians, only input and output are supported as double. Input null value will return null value.

Syntax

COT(<x>)

Parameters

ParameterDescription
<x>The value for which the cotangent is to be calculated

Return Value

Returns a Double type value means the cotangent of x.

Special Cases

  • When x is NaN, returns NaN
  • When x is positive or negative infinity, returns NaN
  • When x is NULL, returns NULL

Example

select cot(1),cot(2),cot(1000);
+--------------------+----------------------+--------------------+
| cot(1) | cot(2) | cot(1000) |
+--------------------+----------------------+--------------------+
| 0.6420926159343306 | -0.45765755436028577 | 0.6801221323348698 |
+--------------------+----------------------+--------------------+

Input null value.

select cot(null);
+--------------------+
| cot(null) |
+--------------------+
| NULL |
+--------------------+
select cot(cast('nan' as double));
+----------------------------+
| cot(cast('nan' AS DOUBLE)) |
+----------------------------+
| NaN |
+----------------------------+
select cot(cast('inf' as double));
+----------------------------+
| cot(cast('inf' AS DOUBLE)) |
+----------------------------+
| NaN |
+----------------------------+
select cot(cast('-inf' as double));
+-----------------------------+
| cot(cast('-inf' AS DOUBLE)) |
+-----------------------------+
| NaN |
+-----------------------------+