w3resource

PHP: expm1() function

Description

The expm1() function is used to calculate the equivalent of exp(x)-1. 'e' is the base of the natural system of logarithms (approximately 2.718282).

Version:

(PHP 4 and above)

Syntax:

expm1(x)

Parameter:

Name Description Required /
Optional
Type
x A number. Required Float

Return value

'e' to the power of x minus one.

Value Type: Float.

Example :

<?php
$val2=1;
$val3=2;
$val4=10;
$zexp2=expm1($val2);
$zexp3=expm1($val3);
$zexp4=expm1($val4);
echo "expm1 of $val2 is $zexp2<br />";
echo "expm1 of $val3 is $zexp3<br />";
echo "expm1 of $val4 is $zexp4<br />";
?>

Output :

View the example in the browser

See also

PHP Function Reference

Previous: exp
Next: floor



Follow us on Facebook and Twitter for latest update.