SQRT in JS

Description

Returns the square root of a number. (JavaScript SQRT Documentation).

Sample Source Pattern

Syntax

Math.sqrt( expression )

Arguments

expression: Numeric expression to calculate tis square root.

Return Type

Same data type sent through parameter as a numeric expression. If the expression sent as parameter is negative, returns NaN.

Examples

CREATE OR REPLACE FUNCTION 
compute_sqrt(a float)
  RETURNS float
  LANGUAGE JAVASCRIPT
AS
$$
  return Math.sqrt(A);
$$
;
SELECT COMPUTE_SQRT(256);

Last updated