English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C Library Function double ldexp(double x, int exponent) returns x multiplied by 2 of exponent power
Below is the declaration of the ldexp() function.
double ldexp(double x, int exponent)
x -- represents the floating-point value of the significant digits.
exponent -- to the power of the exponent.
This function returns the value of x * 2 exp.
The following example demonstrates the usage of the ldexp() function.
#include <stdio.h> #include <math.h> int main () { double x, ret; int n; x = 1.65; n = 5; ret = ldexp(x, n); printf("%f * 2^%d = %f\n", x, n, ret); return(0); }
Let's compile and run the above program, which will produce the following result:
1.650000 * 2^5 = 52.800000