EXP

Compute e raised to the given power.

Category: mathReturns: DOUBLEDialect: Standard

Syntax

EXP(expr)

Description

## Overview Returns e (Euler's number, approximately 2.71828) raised to the power of the input. EXP is the algebraic inverse of LN and is the canonical exponential for continuous compounding, radioactive decay, Poisson processes, logistic models, and every application of the normal distribution. Because e^x grows extremely rapidly, EXP overflows to IEEE 754 positive infinity for inputs above approximately 709.78 and underflows to 0 for inputs below approximately -745. In large workloads this overflow/underflow is usually a symptom of an unstable formulation; rearranging to use LOG-space arithmetic or LOGSUMEXP patterns is the standard remedy. ## Behavior - Domain: all finite DOUBLE values. - Range: (0, infinity). - Returns NULL if the argument is NULL. - Returns exactly 1 for input 0. - Overflows to positive infinity for inputs above approximately 709.78. - Underflows to 0 for inputs below approximately -745. - Is strictly increasing. ## Numeric precision - Uses the IEEE 754 double-precision exp routine, accurate to within one ULP. - Cumulative exponentiation (repeated EXP) is numerically unstable; prefer a single EXP over a product of many. - For small x, EXP(x) is close to 1; use EXPM1(x) when the difference EXP(x) - 1 is what you need. ## Compatibility - Conforms to the SQL standard definition of EXP as a scalar DOUBLE function. - Matches typical mathematical library implementations.

Parameters

NameTypeDescription
exprSpecifies the exponent to which e is raised. Accepts any finite DOUBLE value. Inputs above approximately 709 produce infinity; inputs below approximately -745 produce 0.

Examples

-- Basic literal: e^0 is 1
SELECT EXP(0);
-- Result: 1.0
-- e^1 is Euler's number
SELECT EXP(1);
-- Result: 2.718281828459045
-- e^2
SELECT EXP(2);
-- Result: 7.38905609893065
-- Negative exponent
SELECT EXP(-1);
-- Result: 0.36787944117144233
-- Inverse relationship: EXP(LN(x)) = x
SELECT EXP(LN(10));
-- Result: 10.0
-- Overflow for very large input
SELECT EXP(1000);
-- Result: Infinity

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →