title | ms.custom | ms.date | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | apiname | apilocation | apitype | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl | Microsoft Docs |
11/04/2016 |
|
article |
|
|
DLLExport |
|
|
|
df2f1543-8e39-4af4-a5cf-29307e64807d |
5 |
corob-msft |
corob |
ghogen |
Multiplies a floating-point number by an integral power of FLT_RADIX.
double scalbn(
double x,
int exp
);
float scalbn(
float x,
int exp
); // C++ only
long double scalbn(
long double x,
int exp
); // C++ only
float scalbnf(
float x,
int exp
);
long double scalbnl(
long double x,
int exp
);
double scalbln(
double x,
long exp
);
float scalbln(
float x,
long exp
); // C++ only
long double scalbln(
long double x,
long exp
); // C++ only
float scalblnf(
float x,
long exp
);
long double scalblnl(
long double x,
long exp
);
x
Floating-point value.
exp
Integer exponent.
The scalbn
functions return the value of x
* FLT_RADIX
exp when successful. On overflow (depending on the sign of x
), scalbn
returns +/- HUGE_VAL
; the errno
value is set to ERANGE
.
For more information about errno
and possible error return values, see errno, _doserrno, _sys_errlist, and _sys_nerr.
FLT_RADIX
is defined in <float.h> as the native floating-point radix; on binary systems, it has a value of 2, and scalbn
is equivalent to ldexp.
Because C++ allows overloading, you can call overloads of scalbn
and scalbln
that take and return float
or long double
types. In a C program, scalbn
always takes a double
and an int
and returns a double
, and scalbln
always takes a double
and a long
and returns a double
.
Function | C header | C++ header |
---|---|---|
scalbn , scalbnf , scalbnl , scalbln , scalblnf , scalblnl |
<math.h> | <cmath> |
For additional compatibility information, see Compatibility.
// crt_scalbn.c
// Compile using: cl /W4 crt_scalbn.c
#include <math.h>
#include <stdio.h>
int main( void )
{
double x = 6.4, y;
int p = 3;
y = scalbn( x, p );
printf( "%2.1f times FLT_RADIX to the power of %d is %2.1f\n", x, p, y );
}
6.4 times FLT_RADIX to the power of 3 is 51.2