Use the 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.

In Splunk SPL, exp() works the same way: it computes e^x for a numeric argument.

```sql Splunk example | eval result = exp(log_value) ````
['sample-http-logs']
| extend result = exp(log_value)

In ANSI SQL, EXP() is a standard function with identical semantics.

```sql SQL example SELECT EXP(log_value) AS result FROM logs ```
['sample-http-logs']
| extend result = exp(log_value)

Usage

Syntax

exp(x)

Parameters

Name Type Required Description
x real Yes The exponent value.

Returns

The base-e exponential of x: e^x.

Example

Use exp to compute the geometric mean of request durations from log-transformed values.

Query

['sample-http-logs']
| where req_duration_ms > 0
| summarize geometric_mean = exp(avg(log(req_duration_ms))) by bin(_time, 1h)
| project _time, geometric_mean

Run in Playground

Output

_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
  • log: Returns the natural logarithm. Use it as the inverse of exp or to apply log transformations before aggregating.
  • exp2: Returns 2^x. Use it instead of exp when working with binary (base-2) scales.
  • exp10: Returns 10^x. Use it instead of exp when 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)).

Good evening

I'm here to help you with the docs.

I
AIBased on your context