安卓log.e函数打印示例
C ++ log10()函数 (C++ log10() function)
log10() function is a library function of cmath header, it is used to get the common logarithm (the base-10 logarithm) of the given value. It accepts a value (float, double, or long double) and returns the common logarithm.
log10()函数是cmath标头的库函数,用于获取给定值的常用对数(以10为底的对数)。 它接受一个值( float , double或long double )并返回公共对数。
Syntax of log10() function:
log10()函数的语法:
C++11:
C ++ 11:
double log10 (double x);
float log10 (float x);
long double log10 (long double x);
double log10 (T x);
Parameter(s):
参数:
x – represents the value whose common logarithm to be found.
x –表示要找到其常用对数的值。
Return value:
返回值:
It returns the common logarithm of the given value x.
它返回给定值x的对数。
Note:
注意:
If the given value is negative, it causes a domain error.
如果给定值为负,则将导致域错误。
If the given value is zero, it may cause a pole error.
如果给定值为零,则可能导致极点错误。
Example:
例:
Input:
float x = 10.0f
Function call:
log(x);
Output:
1
C ++代码演示log10()函数的示例 (C++ code to demonstrate the example of log10() function)
// C++ code to demonstrate the example of
// log10() function
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float x = 0.0f;
x = 10.0f;
cout << "log10(" << x << "): " << log10(x) << endl;
x = 1.0f;
cout << "log10(" << x << "): " << log10(x) << endl;
x = 20.0f;
cout << "log10(" << x << "): " << log10(x) << endl;
x = -10.4f;
cout << "log10(" << x << "): " << log10(x) << endl;
x = 0.0f;
cout << "log10(" << x << "): " << log10(x) << endl;
x = 100.6f;
cout << "log10(" << x << "): " << log10(x) << endl;
return 0;
}
Output
输出量
log10(10): 1
log10(1): 0
log10(20): 1.30103
log10(-10.4): nan
log10(0): -inf
log10(100.6): 2.0026
Reference: C++ log10() function
参考: C ++ log10()函数
翻译自: https://www.includehelp.com/cpp-tutorial/log10-function-with-example.aspx
安卓log.e函数打印示例