ldexp
double  ldexp ( double x , int exp );
math.h
  cplusplus.com  

Get floating-point value from mantissa and exponent.
  Calculates the floating point value corresponding to the given mantissa and exponent, such that:
    x * 2exp
  where x parameter represents mantissa and exp parameter the exponent.

Parameters.

x
Floating point value representing mantissa
exp
Integer exponent

Return Value.
  Floating-point value equal to x * 2exp.

Portability.
  Defined in ANSI-C.
  ANSI-C++ adds float and double overloaded versions of this function, with the same bahavior but being both, parameter x and return value, of one of these types.

Example.

/* ldexp example */
#include <stdio.h>
#include <math.h>

main ()
{
  double param, result;
  int n;

  param = 0.95;
  n = 4;
  result = ldexp (param , n);
  printf ("%f * 2^%d = %f\n", param, n, result);
  return 0;
}
Output:
0.950000 * 2^4 = 15.200000

See also.
  frexp, modf, exp


© The C++ Resources Network, 2000