What is math.expm1() in Python?

Python is a high-level programming language that provides functionalities for a number of operations. The math module comes with mathematical methods and constraints, which make for straightforward calculations.

math.expm1() returns ex1e^{x^{\mathrm{}}} - 1, where e is the base of the natural logarithm and x is the value passed as parameter.

Syntax

math.expm1(x)

Parameters

  • x: The exponent value. This parameter is required.

Return value

This function returns a float value that represents ex1e^{x^{\mathrm{}}} - 1.

Code

#import library
import math
id1 = math.expm1(5.463)
print("5.463: ",id1)
id2 = math.expm1(-10.43)
print("-10.43: ",id2)
id3 = math.expm1(0.000)
print("0.000: ",id3)
id4 = math.expm1(293.27)
print("293.27: ",id4)
id5 = math.expm1(-15.89)
print("-15.89: ",id5)

Free Resources