frexp()函数

函数名: frexp   
功 能: 把一个浮点数分解为尾数和指数   
原 型:   double frexp( double x, int *expptr );   
float frexp( float x, int * expptr); // C++ only   
long double frexp( long double x, int * expptr ); // C++ only   
参 数:   
x : 要分解的浮点数据   
expptr : 存储指数的指针   
返回值:   返回尾数   
说 明:   其中 x = 尾数 * 2^指数   
程序例:   
// crt_frexp.c   
// This program calculates frexp( 16.4, &n )   
// then displays y and n.   
#include <math.h>   
#include <stdio.h>   
int main( void )   
{  double x, y;   
    int n;   
    x = 16.4;   
    y = frexp( x, &n );   
    printf( "frexp( %f, &n ) = %f, n = %d\n", x, y, n );
}   
运行结果:   
frexp( 16.400000, &n ) = 0.512500, n = 5   
验证:   16.4 = 0.5125 * 2^5 = 0.5125 * 32
原文地址:https://www.cnblogs.com/eagleking0318/p/6521321.html