Python Tutorial Python Advanced Python References Python Libraries

Python math - expm1() Function



The Python math.expm1() function returns e raised to the power of specified number minus 1, i.e., ex-1. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718282.

Syntax

math.expm1(x)   

Parameters

x Required. Specify the exponent of e.

Return Value

Returns e raised to the power of specified number minus 1, i.e., ex-1.

Example:

In the example below, expm1() function is used to calculate e raised to the power of specified number minus one.

import math

print(math.expm1(2))
print(math.expm1(-2))
print(math.expm1(1.5))
print(math.expm1(-1.5))

The output of the above code will be:

6.38905609893065
-0.8646647167633873
3.481689070338065
-0.7768698398515702

❮ Python Math Module