ExampleEdit & Run
#import the math module
import math

#Use the frexp() function
print(math.frexp(3.142))
Output:
(0.7855, 2) [Finished in 0.010873544961214066s]

The math.frexp() function  returns the mantissa and the exponent of the input number in base 2.  

Syntax:
math.frexp(x) 
x  An integer or a float.

The function returns the mantissa and exponent of x as a pair (m, e), where m is a float with an absolute value between 0.5 (inclusive) and 1.0 (exclusive), and e is an integer such that x == m * 2**e. Where , is the mantissa and is the exponent.

ExampleEdit & Run
import math 

print(math.frexp(0))
print(math.frexp(0.5))
print(math.frexp(4))
print(math.frexp(-9))
print(math.frexp(10))
print(math.frexp(-44))
Output:
(0.0, 0) (0.5, 0) (0.5, 3) (-0.5625, 4) (0.625, 4) (-0.6875, 6) [Finished in 0.010298657231032848s]

  A TypeError is raised if is not an integer or a float.

ExampleEdit & Run
import math

math.frexp(2+3j)
Output:
TypeError: must be real number, not complex [Finished in 0.010150682181119919s]