获取一个浮点数的尾数和指数。
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
对存储的整数指数的指针。
返回值
frexp 返回该尾数。如果 x 为 0,则函数返回 0 该尾数和指数的。如果 expptr 是 NULL,无效参数调用处理程序 参数验证如中所述。如果执行允许继续,此功能设置 errno 到 EINVAL 并返回 0。
备注
frexp 功能为尾数 " (m) 分解浮点值 (x) 和指数 (n),这样 m 的绝对值大于或等于 0.5 并且小于 1.0 和 x = m*2。n整数指数 n 在位置存储指向由 expptr。
C++ 允许重载,因此,您可以调用 frexp重载。在 c. 程序, frexp 总是采用二进制文件和整数并返回二进制文件。
要求
功能  | 
必需的头  | 
|---|---|
frexp  | 
math.h  | 
有关其他的兼容性信息,请参见中介绍的 兼容性 。
示例
// 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 );
}
.NET Framework 等效项
不适用。若要调用标准 C 函数,请使用 PInvoke。有关更多信息,请参见 平台调用示例。