^ [exponentiation]
All functions > MATH > ^ [exponentiation]
Raises a number to a power (integer or floating-point operands of the same type).
Syntax
base ^ exponent · base ** exponent · POW(base, exponent)
Notes
- Both operands must be the same numeric type (both integer or both floating-point)
POW(x, 0)is 1 for any non-zero x;POW(0, y)is 0 for positive y- Returns NULL if either input is NULL
- You can write the operator as
^or**
Related Functions
Examples
^ and ** — integers
FeatureQL
SELECT
-- Caret exponentiation
f1 := 2 ^ 3,
-- Double-asterisk exponentiation
f2 := 2 ^ 3
;Result
| f1 BIGINT | f2 BIGINT |
|---|---|
| 8 | 8 |
^ and ** — floating-point
FeatureQL
SELECT
-- Negative exponent
f1 := 2.0e0 ^ (-2.0e0),
-- Fractional exponent
f2 := 4.0e0 ^ 0.5e0
;Result
| f1 VARCHAR | f2 VARCHAR |
|---|---|
| 0.25 | 2.0 |