#include <math.h>
double frexp( double num, int *exp );
函数将参数 num 分成两部分: 0.5 和 1 之间的尾数(由函数返回)并返回指数 exp。转换成如下的科学计数法形式:
num = mantissa * (2 ^ exp)
#include <math.h>
#include <stdio.h>
int main(void)
{
double mantissa, number;
int exponent;
number = 8.0;
mantissa = frexp(number, &exponent);
printf("The number %lf is ", number);
printf("%lf times two to the ", mantissa);
printf("power of %d\n", exponent);
return 0;
}输出结果:
The number 8.000000 is 0.500000 times two to the power of 4