SQRT()
All functions > MATH > SQRT()
Returns the square root of a number.
Signatures
Square root
Returns: Square root of the input
SQRT(number: T) → DOUBLE sql
| Parameter | Type | Required | Description |
|---|---|---|---|
number | T | Yes | Non-negative floating-point number |
With:
T: Floating-point type (FLOAT, DOUBLE)
Signature notes:
- Only defined for non-negative numbers
- Returns NULL if the input is NULL
- Returns NaN for negative inputs
- To use with integers or decimals, cast explicitly (e.g.
SQRT(2.0E0))
Examples
FeatureQL
SELECT
-- Square root of zero
f1 := SQRT(0.0e0),
-- Square root of one
f2 := SQRT(1.0e0),
-- Perfect square
f3 := SQRT(4.0e0),
-- Another perfect square
f4 := SQRT(25.0e0),
-- Irrational result
f5 := SQRT(2.0e0)
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR | f4 VARCHAR | f5 VARCHAR |
|---|---|---|---|---|
| 0.0 | 1.0 | 2.0 | 5.0 | 1.4142135623730951 |
On this page