frexp - C math.h

C examples for math.h:frexp

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Return the binary significand of x.

Prototype

long double frexpl(long double x, int* exp);
long double frexp (long double x, int* exp);
     double frexp (double x, int* exp);
     double frexp (double x     , int* exp);
      float frexpf(float x      , int* exp);
     double frexp (T x          , int* exp); 

Parameters

Parameter Description
x Value to be decomposed.
exp Pointer to an int where the value of the exponent is stored.

Return Value

The binary significand of x.

Example

Demo Code


#include <stdio.h>
#include <math.h> /* frexp */

int main ()//w w w  .j  a v  a 2s.  c  om
{
  int n;

  double  param = 8.0;
  double  result = frexp (param , &n);
  printf ("%f = %f * 2^%d\n", param, result, n);
  return 0;
}

Related Tutorials