Home >>C Math Functions >C math frexp() function
C math double frexp() function is used to return the worth of the mantissa, and therefore the integer pointed to by exponent is that the exponent. The Value of the resultant x = mantissa * 2 ^ exponent.
Syntax:double frexp(double x, int *exponent)
Parameter | Description |
---|---|
x | It is the floating point value to be computed. |
exponent | It is the pointer to an int object where the value of the exponent is to be stored. |
#include <stdio.h>
#include <math.h>
int main ()
{
double x = 1024, fraction;
int e;
fraction = frexp(x, &e);
printf("x = %.2lf = %.2lf * 2^%d\n", x, fraction, e);
return(0);
}
#include <stdio.h>
#include <math.h>
int main ()
{
double x = 525, fraction;
int e;
fraction = frexp(x, &e);
printf("x = %.2lf = %.2lf * 2^%d\n", x, fraction, e);
return(0);
}