Python math.expm1() Method
Python math.expm1(x) The method returns e raised to the power of x minus 1, where e = 2.718281... is the base of natural logarithms.
math.expm1(x) The method is more accurate than calling math.exp() and subtracting 1.
Python version: 2.7
Syntax
The syntax of the math.expm1() method is as follows:
math.expm1(x)
Parameter Description:
- x -- required, a number specifying the exponent. If x is not a number, a TypeError is returned.
Return Value
A floating-point value representing e^x - 1.
Example
The following example specifies different exponents:
Example
Import the math package
import
math
Specify different exponents
(
math
.
expm1
(
32
)
)
(
math
.
expm1
(
10.89
)
)
Output result:
78962960182679.69
-0.9999813562576685
Python math Module