c語言 函數的參數傳遞示例
C ++ scalbln()函數 (C++ scalbln() function)
scalbln() function is a library function of cmath header. It scales the significand using floating-point base exponent (long int) i.e. it is used to calculate the product of the given significand and FLT_RADIX raised to the power of the given exponent. It accepts two parameters significand and exponent and returns the result of significand * FLT_RADIXexponent.
scalbln()函數是cmath標頭的庫函數。 它使用浮點基指數(long int)縮放有效位數,即,用于計算給定有效 位數與提高到給定指數冪的 FLT_RADIX的乘積。 它接受兩個參數significand和exponent,并返回significand * FLT_RADIX 指數的結果。
Syntax of scalbln() function:
scalbln()函數的語法:
C++11:
C ++ 11:
double scalbln (double x , long int n);
float scalbln (float x , long int n);
long double scalbln (long double x, long int n);
double scalbln (T x , long int n);
Parameter(s):
參數:
x, n – represent the value of significand and exponent.
x,n –表示有效和指數的值。
Return value:
返回值:
It returns the product of the given significand and FLT_RADIX raised to the power of the given exponent.
它返回給定有效數與FLT_RADIX乘以給定指數冪的乘積。
Example:
例:
Input:
double x = 10;
long int n = 2;
Function call:
scalbln(x,n);
Output:
40
C ++代碼演示scalbln()函數的示例 (C++ code to demonstrate the example of scalbln() function)
// C++ code to demonstrate the example of
// scalbln() function
#include <iostream>
#include <cmath>
using namespace std;
// main() section
int main()
{
double x;
long int n;
x = 10;
n = 2;
cout << "scalbln(" << x << "," << n << "): " << scalbln(x, n);
cout << endl;
x = 5.3;
n = 2;
cout << "scalbln(" << x << "," << n << "): " << scalbln(x, n);
cout << endl;
x = 15.46;
n = 12.56;
cout << "scalbln(" << x << "," << n << "): " << scalbln(x, n);
cout << endl;
x = -10.2;
n = 2;
cout << "scalbln(" << x << "," << n << "): " << scalbln(x, n);
cout << endl;
return 0;
}
Output
輸出量
scalbln(10,2): 40
scalbln(5.3,2): 21.2
scalbln(15.46,12): 63324.2
scalbln(-10.2,2): -40.8
Reference: C++ scalbln() function
參考: C ++ scalbln()函數
翻譯自: https://www.includehelp.com/cpp-tutorial/scalbln-function-with-example.aspx
c語言 函數的參數傳遞示例