C
数值 | Numerics

ccosh

ccoshf, ccosh, ccoshl

在头文件中定义
float complex ccoshf( float complex z (1)(since C99)
double complex ccosh( double complex z (2)(since C99)
long double complex ccoshl( long double complex z (3)(since C99)
Defined in header <tgmath.h>
#define cosh( z )(4)(since C99)

1-3)计算复数双曲余弦z

4)类型 - 通用宏:如果z有类型long double complexccoshl被调用。如果z有类型double complexccosh称为,如果z有类型float complexccoshf称为。如果z是真实的或整数,则宏调用相应的实函数(coshfcoshcoshl)。如果z是虚构的,则宏调用函数的相应实际版本cos,实现公式cosh(iy)= cos(y),并且返回类型是实数。

参数

z-复杂的论点

返回值

如果没有错误发生,z则返回复双曲余弦。

错误处理和特殊值

报告的错误与math_errhandling一致。

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

  • ccosh(conj(z)) == conj(ccosh(z))

where cis(y) is cos(y) + i sin(y).

笔记

双曲余弦的数学定义是cosh z =

| ez+e-z |

|:----|

| 2 |

双曲余弦是复平面中的一个完整函数,并且没有分支切割。它是周期性的,相对于虚部,周期为2πi。

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

输出:

cosh(1+0i) = 1.543081+0.000000i (cosh(1)=1.543081) cosh(0+1i) = 0.540302+0.000000i ( cos(1)=0.540302)

参考

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