Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <math.h>
    double frexp( double value, int *exp );

Description:
    The frexp function breaks a floating-point number into a normalized
    fraction and an integral power of 2.  It stores the integral power of 2
    in the int object pointed to by exp.

Returns:
    The frexp function returns the value of x, such that x is a double with
    magnitude in the interval [0.5,1) or zero, and value equals x times 2
    raised to the power *exp.  If value is zero, then both parts of the
    result are zero.

Example:
    #include <stdio.h>
    #include <math.h>

    void main()
      {
        int    expon;
        double value;

        value = frexp(  4.25, &expon );
        printf( "%f %d\n", value, expon );
        value = frexp( -4.25, &expon );
        printf( "%f %d\n", value, expon );
      }

    produces the following:

    0.531250 3
    -0.531250 3

Classification:
    ANSI

Systems:
    Math

See Also:
    ldexp, modf

See Also: ldexp modf

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson