Home >>Python math Module >Python math.ldexp() Method
Python math.ldexp() method is used to return x * (2**i) value of the given input number. It is also called as the inverse of the Python math.frexp() function.
Syntax:math.ldexp(x, i)
Parameter | Description |
---|---|
x | This is a required parameter. It defines any valid +ve or -ve number. |
i | This is a required parameter. It defines any valid +ve or -ve number. |
import math
print(math.ldexp(9, 3))
print(math.ldexp(-5, 2))
import math
print(math.ldexp(3.5, 2))
print('%.2f' %math.ldexp(-6.8, 3))