scalbn - C math.h

C examples for math.h:scalbn

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Scales x by FLT_RADIX raised to the power of n, returning the same as:

scalbn(x,n) = x * FLT_RADIX ^ n

Prototype

long double scalbnl (long double x, int n);
long double scalbn (long double x, int n);
     double scalbn  (double x     , int n);
      float scalbnf (float x      , int n);
      float scalbn (float x      , int n);
     double scalbn (T x          , int n); 

Parameters

Parameter Description
x Value representing the significand.
exp Value of the exponent.

Return Value

Returns x * FLT_RADIX ^ n.

Demo Code

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

int main ()//from  w  w  w .j  a  v a  2s.  co m
{
  double param = 1.50;
  
  int n = 4;
  
  double result = scalbn (param , n);

  printf ("%f * %d^%d = %f\n", param, FLT_RADIX, n, result);

  return 0;
}

Related Tutorials