exp function in APL to compute the base-e exponential of a value: e^x. It’s the inverse of the natural logarithm function log.
exp is useful when you work with log-transformed data and need to recover the original scale. For example, if you have computed the average of log-transformed latencies and want the geometric mean on the original scale, apply exp to the result. You can also use exp to model exponential growth or decay in metric data.
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,
exp() works the same way: it computes e^x for a numeric argument.ANSI SQL users
ANSI SQL users
In ANSI SQL,
EXP() is a standard function with identical semantics.Usage
Syntax
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
x | real | Yes | The exponent value. |
Returns
The base-e exponential ofx: e^x.
Example
Useexp to compute the geometric mean of request durations from log-transformed values.
Query
| _time | geometric_mean |
|---|---|
| 2024-11-14 10:00:00 | 85.3 |
| 2024-11-14 11:00:00 | 92.7 |
| 2024-11-14 12:00:00 | 78.1 |
List of related functions
- log: Returns the natural logarithm. Use it as the inverse of
expor to apply log transformations before aggregating. - exp2: Returns 2^x. Use it instead of
expwhen working with binary (base-2) scales. - exp10: Returns 10^x. Use it instead of
expwhen working with base-10 (decibel or order-of-magnitude) scales. - pow: Raises any base to a power. Use it when the base is not e, 2, or 10.
- sqrt: Returns the square root. Use it for simpler power-of-0.5 calculations rather than
exp(0.5 * log(x)).