All Math methods

frexp() returns the mantissa and exponent of an input number.
frexp(n) # (m,e) 
n : is the input number
m : is the mantissa , a floating point number
e : is the exponent , an integer

Relation between input number with Mantissa and exponent
n == m * 2**e
import math
Output of this is here.
We can check the output
print((0.5)*(2**(3))) # 4.0
Examples with negative numbers
import math
print(math.frexp(-5))    # (-0.625,3)
print((-0.625)*(2**(3))) # -5.0
Using 0
import math
print(math.frexp(0))   # (0.0, 0)
We can also use ldexp() the inverse function of frexp() to get the number n
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer