Get floating-point value from mantissa and exponent: how to use ldexp : Exp « Math « C / ANSI-C






Get floating-point value from mantissa and exponent: how to use ldexp



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

int main () {

  double p, result;
  int n;

  p = 0.95;
  n = 4;
  result = ldexp (p, n);
  printf ("%f * 2^%d = %f\n", p, n, result);
  return 0;
}



           
       








Related examples in the same category

1. Get floating-point value from mantissa and exponent
2.Calculate exponential: how to use exp
3.Get mantissa and exponent of floating-point value: how to use frexp