math.ldexp

Full name
math.ldexp
Library
math
Syntax

math.ldexp(x, i)

Description

The math.ldexp function returns x * (2 ** i). This function is basically the inverse of the math.frexp function.

Result

The math.ldexp function returns a real number.

Examples

We can obtain the result of 1.5 * (2 ** 3) with the following code:

math.ldexp(1.5, 3)

12.0

We confirm that, indeed, this result coincides with the desired calculation:

1.5 * (2 ** 3)

12.0

Submitted by admin on Sun, 01/24/2021 - 10:10