Python frexp() is an inbuilt function under the math library that helps us to find mantissa and exponent of x as the pair (m, e), where m is the float, and e is the integer such that x == m * 2**e. If the value of x is 0 then this function returns (0.0,0), otherwise it returns 5 <= abs(m) <1.

Python frexp()

The frexp() function is one of the Standard math Library functions in Python. It returns mantissa and exponent as a pair (m, e) of a given value x, where mantissa m is a floating-point number, and e exponent is an integer value.m is the float, and e is an integer such that** x == m * 2e exactly.

If the x is zero, returns (0.0, 0), otherwise 0.5 <= abs(m) < 1. This is used to “pick apart” the internal representation of the float in a portable way.

Syntax

math.frexp(x)

Here x is a number for which we will find mantissa and exponent.

#python #python frexp

Python frexp() Function Example
1.45 GEEK