#include <math.h>
double ldexp( double num, int exp );
函数返回参数 num * (2 ^ exp),如果发生溢出返回 HUGE_VAL。
#include <stdio.h> #include <math.h> int main(void) { double value; double x = 2; /* ldexp raises 2 by a power of 3 then multiplies the result by 2 */ value = ldexp(x,3); printf("The ldexp value is: %lf\n", value); return 0; }
输出结果:
The ldexp value is: 16.000000