frexp

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

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:Mathematical Computation

Syntax

  #include <math.h>  
   
  double frexp  (  
     double   value,   
     int      *exp);
  

Parameters

value
(IN) Specifies the original double value.
exp
(OUT) Points to the object.

Return Values

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.

Remarks

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.

See Also

ldexp, modf

Example

  #include <math.h>  
  #include <stdio.h> 
    
  main ()  
  {  
     int expon;  
     printf ("%f %d\n", frexp (4.25, &expon), expon);  
     printf ("%f %d\n", frexp (-4.25, &expon), expon);  
  }
  

produces the following:

   0.531250 3  
  -0.531250 3