expm1(): equivalent to 'exp(num) - 1'

Calculate exp(x) - 1 accurately

expm1() calculates exp($x) - 1 with better numerical accuracy when the input is close to zero.

$x = 0.000001;
echo expm1($x);

Use expm1() instead of exp($x) - 1 when $x is very close to zero, where subtracting nearly equal values can lose precision.

<?Php
echo expm1(5); // Output 147.41315910258 
echo "<br>";
echo expm1(1); // Output 1.718281828459 
echo "<br>";
echo expm1(0); // Output is 0
echo "<br>";
echo expm1(-1); // Output is -0.63212055882856
echo "<br>";
?>
Syntax
float expm1(float $num)

$num is the exponent. The function returns exp($num) - 1.



Math Functions LOG() function


Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer