Chapter Contents

Previous

Next
scalbn

scalbn



Scale a floating point number

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
USAGE NOTES
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

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


DESCRIPTION

scalbn is used to scale a floating-point number by a power of the floating-point base (16 for hexadecimal floating point, 2 for binary floating point). The result is:

[IMAGE]

where b is the floating-point base.

The function name scalbnf should be used for float arguments, and scalbnl for long double arguments. Alternately, if the header file tgmath.h is included, scalbn may be used with any numeric argument type.


RETURN VALUE

scalbn returns the argument, x, scaled by the floating-point base raised to the power n, if that value is expressible.


IMPLEMENTATION

For binary floating-point, scalbn is implemented as a built-in function unless it is undefined by a #undef statement.


USAGE NOTES

scalbn resembles the ldexp function, but differs in using a power of the floating-point base rather than the constant 2 as the scale factor.


RELATED FUNCTIONS

ilogb, ldexp, logb, scalbln


SEE ALSO

"Mathematical Functions" in Chapter 2, "Function Categories"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.