All Math methods

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

Relation between output number with Mantissa ( m ) and exponent ( e )
n == m * 2**e
import math
print(math.ldexp(2,3))  # 16.0 
With negative numbers
print(math.ldexp(-2,3)) # -16.0
print(math.ldexp(2,-3)) # 0.25
The second argument ( exponent ) has to be an integer, we can't use float.
This will generate an TypeError

We can also use frexp() the inverse function of ldexp() to get Mantissa and exponent of n


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-2021 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer