C++ 参考手册
- C++11
- C++14
- C++17
- C++20
- C++ 编译器支持情况表
- 独立与宿主实现
- C++ 语言
- C++ 关键词
- 预处理器
- C++ 标准库头文件
- 具名要求
- 功能特性测试 (C++20)
- 工具库
- 类型支持(基本类型、RTTI、类型特性)
- 概念库 (C++20)
- 错误处理
- 动态内存管理
- 日期和时间工具
- 字符串库
- 容器库
- 迭代器库
- 范围库 (C++20)
- 算法库
- 数值库
- 常用数学函数
- 数学特殊函数
- 伪随机数生成
- 浮点环境
- std::complex
- std::complex<T>::complex
- std::complex<T>::operator=
- std::complex<T>::real
- std::literals::complex_literals::operator""i, operator""if, operator""il
- std::complex<T>::imag
- std::complex<T>::operator+=,-=,*=,/=
- std::complex<T>::operator+(unary), operator-(unary)
- operator+,-,*,/ (std::complex)
- operator==,!=(std::complex)
- operator<<,>>(std::complex)
- std::real(std::complex)
- std::imag(std::complex)
- std::abs(std::complex)
- std::arg(std::complex)
- std::norm(std::complex)
- std::conj(std::complex)
- std::proj(std::complex)
- std::polar(std::complex)
- std::exp(std::complex)
- std::log(std::complex)
- std::log10(std::complex)
- std::pow(std::complex)
- std::sqrt(std::complex)
- std::sin(std::complex)
- std::cos(std::complex)
- std::tan(std::complex)
- std::asin(std::complex)
- std::acos(std::complex)
- std::atan(std::complex)
- std::sinh(std::complex)
- std::cosh(std::complex)
- std::tanh(std::complex)
- std::asinh(std::complex)
- std::acosh(std::complex)
- std::atanh(std::complex)
- std::midpoint
- std::lerp
- std::has_single_bit
- std::bit_ceil
- std::bit_floor
- std::bit_width
- std::rotl
- std::valarray
- 编译时有理数算术
- std::gcd
- std::lcm
- 数学常数
- std::bit_cast
- std::rotr
- std::countl_zero
- std::countl_one
- std::countr_zero
- std::countr_one
- std::popcount
- 注释
- 输入/输出库
- 文件系统库
- 本地化库
- 正则表达式库
- 原子操作库
- 线程支持库
- 实验性 C++ 特性
- 有用的资源
- 索引
- std 符号索引
- 协程支持 (C++20)
- C++ 关键词
位置:首页 > C++ 参考手册 >数值库 >std::complex > std::log10(std::complex)
std::log10(std::complex)
定义于头文件 <complex>
|
||
template< class T > complex<T> log10( const complex<T>& z ); |
||
计算复数值 z
的复常用(底 10 )对数,分支切割沿负实轴。
此函数的行为等价于 std::log(z)/std::log(T(10))
。
参数
z | - | 复数值 |
返回值
z
的复常用对数
示例
运行此代码
#include <iostream> #include <cmath> #include <complex> int main() { std::complex<double> z(0, 1); // // r = 0, θ = pi/2 std::cout << "2*log10" << z << " = " << 2.*std::log10(z) << '\n'; std::complex<double> z2(sqrt(2)/2, sqrt(2)/2); // r = 1, θ = pi/4 std::cout << "4*log10" << z2 << " = " << 4.*std::log10(z2) << '\n'; std::complex<double> z3(-100, 0); // r = 100, θ = pi std::cout << "log10" << z3 << " = " << std::log10(z3) << '\n'; std::complex<double> z4(-100, -0.0); // 切割的另一侧 std::cout << "log10" << z4 << " (the other side of the cut) = " << std::log10(z4) << '\n' << "(note: pi/log(10) = " << acos(-1)/log(10) << ")\n"; }
输出:
2*log10(0,1) = (0,1.36438) 4*log10(0.707107,0.707107) = (0,1.36438) log10(-100,0) = (2,1.36438) log10(-100,-0) (the other side of the cut) = (2,-1.36438) (note: pi/log(10) = 1.36438)
参阅
沿负实轴切割的复自然对数 (函数模板) | |
(C++11)(C++11) |
计算常用(以 10 为底)对数( log10(x) ) (函数) |
应用函数 std::log10 到 valarray 的每个元素 (函数模板) |