Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python math.expm1() Method

Python math.expm1() Method

Python math Module Python math Module

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:

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

print

(

math

.

expm1

(

32

)

)

print

(

math

.

expm1

(

10.89

)

)

Output result:


78962960182679.69
-0.9999813562576685

Python math Module Python math Module