Name
ctanh
Synopsis
Calculates the hyperbolic tangent of a complex number
#include <complex.h> double complexctanh
( double complexz
); float complexctanhf
( float complexz
); long double complexctanhl
( long double complexz
);
The hyperbolic tangent of a complex number
z
is equal to
sinh(z
) /
cosh(z
). The ctanh
functions return the hyperbolic
tangent of their complex argument.
Example
double complex v, w, z = -0.5 + 1.23 * I;
v =ctanh
( z );
w = csinh( z ) / ccosh( z );
printf("The ctanh() function returns %.2f %+.2f*I.\n", creal(v), cimag(v) );
printf("Using the csinh() and ccosh() functions yields %.2f %+.2f*I.\n",
creal(w), cimag(w) );
This code produces the following output:
The ctanh() function returns -1.53 +0.82*I. Using the csinh() and ccosh() functions yields -1.53 +0.82*I.
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.