COT in JS

Description

Sample Source Pattern

Implementation example

function cot(angle){
    return Math.cos(angle)/Math.sin(angle);
}

Arguments

angle: Numeric expression in radians.

Return Type

Same data type sent through parameter as a numeric expression.

Examples

CREATE OR REPLACE FUNCTION compute_cot(angle float)
  RETURNS float
  LANGUAGE JAVASCRIPT
AS
$$
  function cot(angle){
    return Math.cos(angle)/Math.sin(angle);
  }
  return cot(ANGLE);
    
$$
;
SELECT COMPUTE_COT(1);

Last updated