Easy Tutorial
❮ Python Armstrong Number Python Requests ❯

Python math.expm1() Method

Python math Module

The math.expm1(x) method in Python returns e raised to the power of x, minus 1, e^x - 1, where e = 2.718281... is the base of the natural logarithm.

The math.expm1(x) method is more accurate than calling math.exp() and subtracting 1.

Python Version: 2.7

Syntax

The syntax for the math.expm1() method is as follows:

math.expm1(x)

Parameter:

Return Value

A floating-point value representing e^x - 1.

Example

The following example demonstrates specifying different exponents:

# Import math package
import math

# Specify different exponents
print(math.expm1(32))
print(math.expm1(-10.89))

Output:

78962960182679.69
-0.9999813562576685

Python math Module

❮ Python Armstrong Number Python Requests ❯