COT

Returns the cotangent value of a numeric expression

Syntax

COT( expr )

Arguments

Parameter Description
expr Numeric expression representing an angle in radians

Returns

Always returns a floating point result of the cotangent.

Notes

  • The result is in the range [0, infinity).
  • If the input value is NULL, the result is NULL.

Examples

For these examples, consider the following table and contents:

CREATE TABLE trig(f DOUBLE);

INSERT INTO trig VALUES (0), (PI()/12), (PI()/8), (PI()/6)
   , (PI()/4), (PI()/3), (3*PI()/8), (5*PI()/12), (PI()/2);

Cotangent of π/4 (= 1)

Tip

Use RADIANS to convert degrees to radians

numbers=> SELECT COT(PI()/4), COT(RADIANS(45));
cot | cot0
----+-----
  1 |    1

Computing cotangents for a column, in radians

numbers=> SELECT f, COT(f) FROM trig;
f      | cot
-------+------------------
     0 | 16331239353195370
0.2618 |            3.7321
0.3927 |            2.4142
0.5236 |            1.7321
0.7854 |                 1
1.0472 |            0.5774
1.1781 |            0.4142
 1.309 |            0.2679
1.5708 |                 0