首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::tanh(std::complex)

Defined in header <complex>

?

?

template< class T > complex<T> tanh( const complex<T>& z );

?

(since C++11)

求复值的复双曲正切z...

参数

z

-

complex value

返回值

如果没有误差,则复双曲切线z会被归还。

错误处理和特殊值

错误报告与math_errhandling...

如果实现支持ieee浮点算法,

  • std::tanh(std::conj(z))== std::conj(std::tanh(z))
  • std::tanh(-z)==-std::tanh(z)
  • 如果z(+0,+0),结果是(+0,+0)
  • 如果z(x,+∞)28%[1]有限x%29,结果是(NaN,NaN)FE_INVALID提出来
  • 如果z(x,NaN)28%[2]有限x%29,结果是(NaN,NaN)FE_INVALID可能被提高
  • 如果z(+∞,y)对于任何有限的正y%29,结果是(1,+0)
  • 如果z(+∞,+∞),结果是(1,±0)%28虚设部分的符号未指定为%29
  • 如果z(+∞,NaN),结果是(1,±0)%28虚设部分的符号未指定为%29
  • 如果z(NaN,+0),结果是(NaN,+0)
  • 如果z(NaN,y)对于任何非零y%29,结果是(NaN,NaN)FE_INVALID可能被提高
  • 如果z(NaN,NaN),结果是(NaN,NaN)
  • c11DR471,这只适用于非零x,如果z(0,∞),结果应该是(0,NaN)
  • c11DR471,这只适用于非零x,如果z(0,NaN),结果应该是(0,NaN)

注记

双曲正切的数学定义为tanhz=

伊兹

*。

ez+e-z

双曲切线是复平面上的一个解析函数,不存在分支割线。它是周期的,相对于虚分量,周期πi,并且在坐标%280,π%281/2+n%29%29处,沿虚线具有一阶极点。然而,没有一个普通的浮点表示法能够精确地表示π/2,因此没有发生极点误差的参数的值。

二次

代码语言:javascript
复制
#include <iostream>
#include <cmath>
#include <complex>
 
int main()
{
    std::cout << std::fixed;
    std::complex<double> z(1, 0); // behaves like real tanh along the real line
    std::cout << "tanh" << z << " = " << std::tanh(z)
              << " (tanh(1) = " << std::tanh(1) << ")\n";
 
    std::complex<double> z2(0, 1); // behaves like tangent along the imaginary line
    std::cout << "tanh" << z2 << " = " << std::tanh(z2)
              << " ( tan(1) = " << std::tan(1) << ")\n";
}

二次

产出:

二次

代码语言:javascript
复制
tanh(1.000000,0.000000) = (0.761594,0.000000) (tanh(1) = 0.761594)
tanh(0.000000,1.000000) = (0.000000,1.557408) ( tan(1) = 1.557408)

二次

另见

sinh(std::complex)

computes hyperbolic sine of a complex number (sh(z)) (function template)

cosh(std::complex)

computes hyperbolic cosine of a complex number (ch(z)) (function template)

atanh(std::complex) (C++11)

computes area hyperbolic tangent of a complex number (function template)

tanh

hyperbolic tangent (function)

tanh(std::valarray)

applies the function std::tanh to each element of valarray (function template)

c ctanh文件

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com