Home >>PHP Math Functions >PHP expm1() Function

PHP expm1() Function

PHP expm1() Function

PHP expm1() function is used to calculate e raised to the power of the given input argument minus one (ex-1). It takes a single parameter $power which is the power e has to be raised to. It returns a floating point value as output which is the value of e raised to the power of the given $power argument -1.

Syntax:

  expm1($power);

Parameter Values

Parameter Description
power This is a required parameter. This parameter defines the given exponent value.

Here is an example of expm1() function in PHP:

<html>
<body>

<?php

echo "Value of (e1) : ".exp(1)."<br>";
echo "Value of (e1-1) : ".expm1(1)."<br>";
echo "Value of (e2) : ".exp(2)."<br>";
echo "Value of (e2-1) : ".expm1(2)."<br>";

?>

</body>
</html>
Output:
Value of (e1) :  2.718281828459
Value of (e1-1) :  1.718281828459
Value of (e2) :  7.3890560989307
Value of (e2-1) :  6.3890560989307

Here is an another example of expm1() function in PHP:

<html>
<body>

<?php

echo expm1(0)."<br>";
echo expm1(1)."<br>";
echo expm1(5)."<br>";
echo expm1(8.5)."<br>";
echo expm1(21)."<br>";
echo expm1(25.5)."<br>";

?>

</body>
</html>
Output:
0
1.718281828459
147.41315910258
4913.7688402991
1318815733.4832
118716009131.17

No Sidebar ads