Python math.exp() Method

Python math 模块Python math Module

Python math.exp(x)The method returns e raised to the x power Ex, where e = 2.718281... is the base of the natural logarithm.

Python version: 1.6.1

Syntax

The syntax of the math.exp() method is as follows:

math.exp(x)

Parameter description:

  • x-- Required, a number, specifying the exponent. If x is not a number, returns TypeError.

Return Value

A floating-point value representing e raised to the power of x.

Example

The following example specifies different exponents:

Example

# Import the math package
import math

# Specify different exponents
print(math.exp(65))
print(math.exp(-6.89))

Output result:

1.6948892444103338e+28
0.0010179138409954387

Python math 模块Python math Module

Other Extensions