Physics · function

exactExp

Math.exp, reproducibly.

Explained in Your first game, Rigid bodies.

function exactExp(x: number): number
import { exactExp } from '@driftengine/physics';

Parameters

ParameterTypeDescription
xnumber

In depth

Reduce by a multiple of ln 2 into [-ln2/2, ln2/2], sum the Taylor series there, and scale by a power of two. A degree-14 series and not a shorter minimax, because on that interval the fifteenth term is about 4e-20 — below the precision of a double — so the series is exact to the representation and there is nothing a fitted polynomial would buy.