expm1()

expm1() — Returns exp($num) - 1, computed in a way that is accurate even when the value of number is close to zero.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

expm1() returns the equivalent to exp($num) - 1 computed in a way that is accurate even if the value of num is near zero, a case where exp($num) - 1 would be inaccurate due to subtraction of two numbers that are nearly equal.

Signature

expm1(float $num): float

Parameters

ParameterTypeWhat it takes
$numfloatThe argument to process

Return value

e to the power of num, minus one.

Example

The PHP manual ships no example for expm1(); the signature and the parameter table above are the contract.

See also

log1p(), exp()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page expm1() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.