NumbersSQL standard
SQRT
Takes the square root of a number.
Syntax
SQRT(<number>)
CBRT(<number>)
SQRT(16) gives 4. For an integer the result is double precision, and for numeric — numeric. The cube root is CBRT.
Takes the square root of a number.
SQRT(<number>)
CBRT(<number>)
SQRT(16) gives 4. For an integer the result is double precision, and for numeric — numeric. The cube root is CBRT.
| square_root | irrational | cube_root |
|---|---|---|
| 4 | 1.4142135623730951 | 3 |
| distance |
|---|
| 5 |
The root of a negative number is an error: SQRT(-4) says cannot take square root of a negative number.
For an integer argument the result is double precision, with possible rounding errors: SQRT(2) is 1.4142135623730951. For exact calculations pass a numeric: SQRT(2::numeric).
|/ is the same root as an operator: |/ 16 gives 4. But few people will recognise it in code, so SQRT is clearer.