Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/frexp.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/frexp.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/frexp.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/frexp.html on line 8

frexp(), frexpf()

Break a floating-point number into a normalized fraction and an integral power of 2

Synopsis:

#include <math.h>

double frexp( double value, 
              int* exp );

float frexpf( float value, 
              int* exp );

Arguments:

value
The value you want to break into a normalized fraction.
exp
A pointer to a location where the function can store the integral power of 2.

Library:

libm

Use the -l m option to qcc to link against this library.

Description:

These functions break a floating-point number into a normalized fraction and an integral power of 2. It stores the integral power of 2 in the int pointed to by exp.

Returns:

x, such that x is a double with magnitude in the interval [0.5, 1] or 0, and value equals x times 2 raised to the power exp. If value is 0, then both parts of the result are 0.

Examples:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main( void )
{
    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 );

    return EXIT_SUCCESS;
}

produces the output:

0.531250 3
-0.531250 3

Classification:

ANSI, POSIX 1003.1

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

ldexp(), modf()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/frexp.html on line 155

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/frexp.html on line 155