Double-precision floating point (±1.7E±308, ~15 decimal digits)
1st Parameter
The floating-point value to be scaled.
2nd Parameter Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
2nd Parameter
The power of 2 by which the value `x` will be scaled.
Read more about parameters of ldexp in parameters section
The ldexpfunction in C language Multiplies a floating-point number by an integral power of 2.
The ldexp function multiplies a floating-point number x by 2 raised to the power of exp. It's equivalent to x * 2^exp, but is often more efficient and accurate. This function is useful in manipulating the exponent part of a floating-point number.
The ldexpfunction takes 2
parameters:
•
double `x`: The floating-point value to be scaled.
•
int `exp`: The power of 2 by which the value `x` will be scaled.
Computes the result of multiplying the floating-point number `x` by 2 raised to the power of `exp` (i.e., x × 2^exp). This function is useful for constructing floating-point numbers from a mantissa and an exponent. Returns the scaled value as a `double`.
The ldexp function return value :
Returns x * 2^exp
Output
This example demonstrates basic usage of ldexp function to multiply a number by 2^3.