c语言 函数的参数传递示例
C ++ scalbln()函数 (C++ scalbln() function)
scalbln() functionis a library function ofcmathheader. It scales the significand using floating-point base exponent (long int) i.e. it is used to calculate the product of the givensignificandandFLT_RADIXraised to the power of the givenexponent. It accepts two parameterssignificandandexponentand returns the result ofsignificand * 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() sectionint 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): 40scalbln(5.3,2): 21.2scalbln(15.46,12): 63324.2scalbln(-10.2,2): -40.8
Reference: C++ scalbln() function
参考: C ++ scalbln()函数
翻译自: /cpp-tutorial/scalbln-function-with-example.aspx
c语言 函数的参数传递示例