Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
base
logarithm
communitycreator

What is math.expm1() in Python?

Eman Kashif

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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)

RELATED TAGS

python
base
logarithm
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring