frexp

Calculates the fractional and exponent parts of a double value.

Format

#include  <math.h>

double frexp  (double value, int *eptr);

Arguments

value
An object of type double.
eptr
A pointer to an int, to which frexp returns the exponent.

Description

This function converts value to the following form:
value = fraction * (2exp)

The fractional part is returned as the return value. The exponent is placed in the integer variable pointed to by eptr.

Example

    main ()
    {
       double val = 16.0, fraction;
       int exp;
    
       fraction = frexp(val, &exp);
       printf("fraction = %f\n",fraction);
       printf("exp = %d\n",exp);
    
    }
    

    In this example, frexp converts the value 16 to .5*2 5 . The example produces the following output:

    fraction = 0.500000
    exp = 5
    

Return Value
The fractional part of the double value. 


Previous Page | Next Page | Table of Contents | Index