Skip to content

Latest commit

 

History

History
123 lines (105 loc) · 3.62 KB

scalbn-scalbnf-scalbnl-scalbln-scalblnf-scalblnl.md

File metadata and controls

123 lines (105 loc) · 3.62 KB
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
cpp-standard-libraries
article
scalblnl
scalbnl
scalbnf
scalblnf
scalbn
scalbln
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-math-l1-1-0.dll
DLLExport
scalblnf
scalbnl
scalblnl
scalbln
scalbn
scalbnf
C++
scalbn function
scalbln function
scalblnl function
scalbnl function
scalbnf function
scalblnf function
df2f1543-8e39-4af4-a5cf-29307e64807d
5
corob-msft
corob
ghogen

scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl

Multiplies a floating-point number by an integral power of FLT_RADIX.

Syntax

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  
);  

Parameters

x
Floating-point value.

exp
Integer exponent.

Return Value

The scalbn functions return the value of x * FLT_RADIXexp 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.

Remarks

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.

Requirements

Function C header C++ header
scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl <math.h> <cmath>

For additional compatibility information, see Compatibility.

Example

// 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 );  
}  

Output

6.4 times FLT_RADIX to the power of 3 is 51.2  

See Also

Floating-Point Support
frexp
ldexp
modf, modff, modfl