frexp
double frexp ( double x , int * exp ); | math.h |
cplusplus.com |
Get mantissa and exponent of floating-point value.
Calculates mantissa (a floating-point value between 0.5 and 1) and exponent
(an integer value), such that:
x = mantissa * 2exponent
where x is parameter x, mantissa is the value returned
by the function and exponent is set by the function at location pointed
by exp.
Parameters.
Return Value.
Mantissa.
Portability.
Defined in ANSI-C.
ANSI-C++ adds float and double overloaded versions of this function,
with the same bahavior but being both, parameter x and return value, of one of
these types.
Example.
/* frexp example */ #include <stdio.h> #include <math.h> main () { double param, result; int n; param = 15.2; result = frexp (param , &n); printf ("%f * 2^%d = %f\n", result, n, param); return 0; }Output: