ffrreexxpp() -- General Function (libc)

Separate fraction and exponent
#iinncclluuddee <mmaatthh.hh>
ddoouubbllee ffrreexxpp(_r_e_a_l, _e_p)
ddoouubbllee _r_e_a_l; iinntt *_e_p;

ffrreexxpp() breaks  double-precision floating  point numbers into  fraction and
exponent.  It returns the fraction _m of its _r_e_a_l argument, such that 0.5 <=
_m < 1  or _m=0, and stores the binary  exponent _e in the location pointed to
by _e_p. These numbers satisfy the equation _r_e_a_l = _m * 2_e.

_E_x_a_m_p_l_e
This example prompts  for a number, then uses ffrreexxpp()  to break it into its
fraction and exponent.

#include <stdio.h>

main()
{
    extern char *gets();
    extern double frexp(), atof();
    double real, fraction;
    int ep;

    char string[64];

    for (;;) {
        printf("Enter number: ");
        if (gets(string) == NULL)
            break;


        fraction = frexp(real, &ep);
        printf("%lf is the fraction of %lf\n",
            fraction, real);
        printf("%d is the binary exponent of %lf\n",
            ep, real);
    }

    putchar('\n');
}

_S_e_e _A_l_s_o
aattooff(), cceeiill(), ffaabbss(), fflloooorr(), llddeexxpp(), lliibbcc, mmooddff()
ANSI Standard, section 7.5.4.3
POSIX Standard, section 8.1
