C++ 中用于复数的 log10() 函数
在本文,我们将讨论 C++ STL 中 log10() 函数的工作原理、语法和示例。
log10() 是什么函数?
log10() 是 C++ STL 中的一个内置函数,在 <complex> 头文件中定义。log10() 用于查找复数的常用对数。此函数返回复数 num 以 10 为底的常用复数对数值。
语法
template<class T> complex<T> log10(const complex<T>& num);
参数
此函数接受一个参数 num,这是一个我们必须找到对数的复数值。
返回值
我们想要计算的 num 常用复数对数值。
示例
Input: complex<double> C_number(-4.0, -1.0); Log10(C_number); Output: log10 of (-4,-1) is (0.615224,-1.25798)
示例
#include <bits/stdc++.h>
using namespace std;
int main() {
complex<double> C_number(-4.0, -1.0);
cout<<"log10 of "<< C_number<< " is "<<log10(C_number);
return 0;
}输出
如果我们运行上述代码,它将生成以下输出 −
log10 of (-4,-1) is (0.615224,-1.25798)
示例
#include <bits/stdc++.h>
using namespace std;
int main() {
complex<double> C_number(-4.0, 1.0);
cout<<"log10 of "<< C_number<< " is "<<log10(C_number);
return 0;
}输出
如果我们运行上述代码,它将生成以下输出 −
log10 of (-4,1) is (0.615224,1.25798)
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP