Extracts the mantissa and exponent from a floating point number's binary representation.
#include <math.h> double frexp(double x, int* e); float frexpf(float x, int* e); long double frexpl(long double x, int* e);
x
The floating point value to extract from.
e
A pointer to an integer in which to store the exponent.
A floating point number's binary representation follows this formula:
m 2 e
where m is the mantissa and e is the exponent, 0.5 < m < 1.0 and e is an integer value.
These functions return, when possible, the value of a floating-point number's exponent ine and returns the mantissa.
This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.
#include <math.h> #include <stdio.h> int main(void) { double m, value = 12.0; int e; m = frexp(value, &e); printf("%f = %f * 2 to the power of %d.\n",value, m, e); return 0; } Output: 12.000000 = 0.750000 * 2 to the power of 4.