# fixed_exp

Computes e^(x / 1e18) * 1e18 for an 18-decimal fixed-point (WAD) exponent, with integer arithmetic only. NULL propagates; an exponent outside [-41e18, 130e18] errors. Results equal, digit for digit, those of the LogExpMath library that Balancer V2 and Pendle V2 contracts use, so a query recomputes an on-chain rate exactly. Accuracy: within 1e-17 relative for results of 1e17 or more; a few wei near 1e18 (exp(1e18) is 2718281828459045235); a tiny result keeps few digits (exp(-41e18) is 1, true 1.56).

Canonical HTML: <https://determica.com/docs/functions/fixed_exp>

- Kind: scalar function
- Category: [Fixed-point and AMM math](/docs/category/fixed-point-and-amm-math.md)
- Tags: Fixed Point Math, Deterministic, Offline, Types

Computes e^(x / 1e18) * 1e18 for an 18-decimal fixed-point (WAD) exponent, with integer arithmetic only. NULL propagates; an exponent outside [-41e18, 130e18] errors. Results equal, digit for digit, those of the LogExpMath library that Balancer V2 and Pendle V2 contracts use, so a query recomputes an on-chain rate exactly. Accuracy: within 1e-17 relative for results of 1e17 or more; a few wei near 1e18 (exp(1e18) is 2718281828459045235); a tiny result keeps few digits (exp(-41e18) is 1, true 1.56).

## Overload 1: fixed_exp(INT256)

```sql
fixed_exp(INT256)
```

Computes e^(x / 1e18) * 1e18 for an 18-decimal fixed-point (WAD) exponent, with integer arithmetic only. NULL propagates; an exponent outside [-41e18, 130e18] errors.

- Kind: scalar
- Execution context: Offline
- Behavior: Transform
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `x` (INT256; required; positional) — Exponent with 18 decimals, in [-41e18, 130e18]: INT256, or UINT256 from 0 (a rate times a time from muldiv).

### Returns

WAD e^x

UINT256 e^(x / 1e18) * 1e18; NULL for NULL input. An exponent out of range errors.

- `result` (UINT256)

WAD e^x. UINT256 e^(x / 1e18) * 1e18; NULL for NULL input. An exponent out of range errors.

### Examples

_Local SQL · Local_

```sql
SELECT fixed_exp((-1000000000000000000)::INT256)::VARCHAR AS inverse_e_wad;
-- => [{"inverse_e_wad":"367879441171442321"}]
```

## Overload 2: fixed_exp(UINT256)

```sql
fixed_exp(UINT256)
```

Computes e^(x / 1e18) * 1e18 for a non-negative UINT256 WAD exponent of at most 130e18, such as a rate times a time from muldiv.

- Kind: scalar
- Execution context: Offline
- Behavior: Transform
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `x` (UINT256; required; positional) — Exponent with 18 decimals, in [-41e18, 130e18]: INT256, or UINT256 from 0 (a rate times a time from muldiv).

### Returns

WAD e^x

UINT256 e^(x / 1e18) * 1e18; NULL for NULL input. An exponent out of range errors.

- `result` (UINT256)

WAD e^x. UINT256 e^(x / 1e18) * 1e18; NULL for NULL input. An exponent out of range errors.

### Examples

_Local SQL · Local_

```sql
-- A continuously compounded rate of ln(1.143) (WAD) over 50 days, as a growth factor
SELECT fixed_exp(muldiv(133670644092229524::UINT256, 4320001::UINT256, 31536000::UINT256))::VARCHAR AS growth_wad;
-- => [{"growth_wad":"1018479726643403642"}]
```

## Related functions

- [fixed_ln](/docs/functions/fixed_ln.md) — Alternative
- [fixed_pow](/docs/functions/fixed_pow.md) — See Also
- [muldiv](/docs/functions/muldiv.md) — Usually Before
- [fixed_div](/docs/functions/fixed_div.md) — Usually After
