Definition | #include <math.h> double frexp(double value, int *e_p); The functions split a floating-point number value into the mantissa x and the exponent n on thebasis of the formula: value = x * 2n | |||
n | is in the interval [0.5, 1.0[ is an integer | |||
The result from these functions is the mantissa x and an integer value for the exponent n. The exponent is returned indirectly via a result parameter e_p.
| ||||
Return val. | Mantissa x | a floating-point number of type | ||
0 | if value is equal to 0 (the exponent is also equal to 0 in this case). | |||
Note | Note that the argument e_p must be a pointer! | |||
Example | Normalized representation of the number 5 to base 2: #include <stdio.h> #include <math.h> int main(void) { double z; int exp; z = frexp((double)5, &exp); printf("5 = %g * 2 ** %d\n", z, exp); return 0; } | |||
See also | ldexp, modf |