Name
ccosh
Synopsis
Calculates the hyperbolic cosine of a complex number
#include <complex.h> double complexccosh
( double complexz
); float complexccoshf
( float complexz
); long double complexccoshl
( long double complexz
);
The hyperbolic cosine of a complex number
z
is equal to
(exp(z
) +
exp(-z
)) / 2. The ccosh
functions return the hyperbolic
cosine of their complex argument.
Example
double complex v, w, z = 1.2 − 3.4 * I;
v =ccosh
( z );
w = 0.5 * ( cexp(z) + cexp(-z) );
printf( "The ccosh() function returns %.2f %+.2f*I.\n",
creal(v), cimag(v) );
printf( "Using the cexp() function, the result is %.2f %+.2f*I.\n",
creal(w), cimag(w) );
This code produces the following output:
The ccosh() function returns -1.75 +0.39*I. Using the cexp() function, the result is -1.75 +0.39*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.