The math.ldexp() function returns a floating-point number equal to x*(2**i). The ldexp in the functions name stands for  "load exponent".

Syntax:
math.ldexp(x,i) 

Where,  parameter  x  is an integer or a  floating-point number. Parameter i  is the integer exponent, it should be strictly an integer value, otherwise, a TypeError is raised.

The function returns a floating-point number equal to x*(2**i).

ExampleEdit & Run
import math 

print(math.ldexp(3, 2))
print(math.ldexp(2.5, 5))
print(math.ldexp(4.1, 5))
print(math.ldexp(10, 10))
Output:
12.080.0131.210240.0[Finished in 0.010784386191517115s]

Math.ldexp is useful in Python for scaling a number using the exponent value. It is commonly used in scientific computing to quickly multiply a number by a power of two. It can also be used to scale a number up or down to the nearest integer, handle overflow, and adjust to the precision of the floating-point format.

The following example uses math.ldexp() to scale pi up by a factor of 8.  

ExampleEdit & Run
import math

print(math.ldexp(math.pi, 8))
Output:
804.247719318987[Finished in 0.01027608709409833s]