pow function in APL to raise a base value to a given exponent: base^exponent. The function accepts any real base and exponent.
pow is useful whenever you need to apply a power function to a metric, such as squaring deviations for variance calculations, computing exponential growth factors, scaling values by a fractional power, or inverting a power transformation. It’s more flexible than exp, exp2, or exp10 because you can specify any base.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.Splunk SPL users
Splunk SPL users
In Splunk SPL,
pow(base, exponent) works identically to APL’s pow. You can also use the ^ operator for the same purpose.ANSI SQL users
ANSI SQL users
In ANSI SQL,
POWER(base, exponent) provides the same functionality as APL’s pow.Usage
Syntax
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
base | real | Yes | The base value. |
exponent | real | Yes | The exponent to raise the base to. |
Returns
base raised to the power exponent: base^exponent.
Example
Usepow to square the deviation of each request’s duration from a 200 ms baseline.
Query
| _time | id | req_duration_ms | squared_deviation |
|---|---|---|---|
| 2024-11-14 10:00:00 | user-1 | 1200.0 | 1000000.0 |
| 2024-11-14 10:01:00 | user-2 | 80.0 | 14400.0 |
| 2024-11-14 10:02:00 | user-3 | 205.0 | 25.0 |
List of related functions
- sqrt: Returns the square root of a value. This is equivalent to
pow(x, 0.5)and is more readable for the square-root case. - exp: Returns e^x. Use it when the base is e rather than an arbitrary number.
- exp2: Returns 2^x. Use it when the base is always 2.
- exp10: Returns 10^x. Use it when the base is always 10.
- log: Returns the natural logarithm. Use it to undo a
powtransformation in log space.