^ [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)
Function form
Power: Base raised to the power of exponent
POW(base: T, exponent: T) → T sql
| Parameter | Type | Required | Description |
|---|---|---|---|
base | T | Yes | The base number |
exponent | T | Yes | The exponent |
With:
T: Any numeric typeSame-type numeric pairs, or a floating/DECIMAL base with an integer exponent
POW(x, 0) = 1for any non-zero xPOW(0, y) = 0for positive yReturns NULL if either input is NULL
Alias: POWER
Aliases: POWER
Notes
- Same-type numeric pairs, or a floating/DECIMAL base with an integer exponent
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**
Examples
^ and ** — integers
FeatureQL
RETURN
-- Caret exponentiation
f1 := 2 ^ 3,
-- Double-asterisk exponentiation
f2 := 3 ^ 2
;Result
| f1 BIGINT | f2 BIGINT |
|---|---|
| 8 | 9 |
^ and ** — floating-point
FeatureQL
RETURN
-- Negative exponent
f1 := 2.0e0 ^ (-2.0e0),
-- Fractional exponent
f2 := 4.0e0 ^ 0.5e0
;Result
| f1 DECIMAL | f2 DECIMAL |
|---|---|
| 0.25 | 2.0 |
POW(...)
FeatureQL
RETURN
-- Function call
f1 := POW(2, 3)
;Result
| f1 BIGINT |
|---|
| 8 |
.POW(...) — chained
FeatureQL
RETURN
-- Integer literal: parenthesize for `.POW` on BIGINT
f1 := (2).POW(3),
-- DOUBLE operands: chain without extra parentheses (same-type floating-point power)
f2 := 2e0.POW(3e0)
;Result
| f1 BIGINT | f2 DECIMAL |
|---|---|
| 8 | 8.0 |
POW — Edge cases
FeatureQL
RETURN
-- Square
f1 := POW(5, 2),
-- Exponent zero
f2 := POW(10, 0),
-- Negative exponent (DOUBLE)
f3 := POW(2.0e0, -2.0e0),
-- Fractional exponent (DOUBLE)
f4 := POW(4.0e0, 0.5e0)
;Result
| f1 BIGINT | f2 BIGINT | f3 DECIMAL | f4 DECIMAL |
|---|---|---|---|
| 25 | 1 | 0.25 | 2.0 |