C
数值 | Numerics

ctanhf

ctanhf, ctanh, ctanhl

在头文件中定义
float complex ctanhf(float complex z);(1)(自C99以来)
double complex ctanh(double complex z);(2)(自C99以来)
long double complex ctanhl( long double complex z (3)(自C99以来)
在头文件<tgmath.h>中定义
#define tanh(z)(4)(自C99以来)

1-3)计算z的复双曲正切。

4)类型通用宏:如果z有类型long double complex,则调用ctanhl。 如果z具有类型double complex,则调用ctanh,如果z具有类型float complex,则调用ctanhf。 如果z是实数或整数,则宏调用相应的实函数(tanhf,tanh,tanhl)。 如果z是虚数,那么宏调用函数tan的相应实数版本,实现公式tanh(iy)= i tan(y),并且返回类型是虚数。

参数

z-complex argument

返回值

如果没有错误发生,则返回z的复双曲正切值。

错误处理和特殊值

报告的错误与math_errhandling一致。

如果实现支持IEEE浮点运算,

ctanh(conj(z))== conj(ctanh(z))

注意

双曲正切的数学定义是cosh z =

| ez-e-z |

|:----|

| ez+e-z |

双曲正切是复杂平面上的分析函数,并且没有分支切割。它相对于周期为πi的虚部具有周期性,并且在坐标(0,π(1/2 + n))处具有沿假想线的一阶极点。然而,没有共同的浮点表示法能够精确地表示π/ 2,因此没有出现极点错误的参数值。

#include <stdio.h> #include <math.h> #include <complex.h> int main(void) { double complex z = ctanh(1 // behaves like real tanh along the real line printf("tanh(1+0i) = %f%+fi (tanh(1)=%f)\n", creal(z), cimag(z), tanh(1) double complex z2 = ctanh(I // behaves like tangent along the imaginary line printf("tanh(0+1i) = %f%+fi ( tan(1)=%f)\n", creal(z2), cimag(z2), tan(1) }

输出:

tanh(1+0i) = 0.761594+0.000000i (tanh(1)=0.761594) tanh(0+1i) = 0.000000+1.557408i ( tan(1)=1.557408)

参考

  • C11标准(ISO / IEC 9899:2011):

扩展内容

csinhcsinhfcsinhl(C99)(C99)(C99)计算复数双曲正弦函数(函数)
ccoshccoshfccoshl(C99)(C99)(C99)计算复双曲余弦(函数)
catanhcatanhfcatanhl(C99)(C99)(C99)计算复圆弧双曲正切(函数)
tanhtanhftanhl(C99)(C99)计算双曲正切(函数)

| tanh的C ++文档 |