Name
cacosh
Synopsis
Calculates the inverse hyperbolic cosine of a complex number
#include <complex.h> double complexcacosh
( double complexz
); float complexcacoshf
( float complexz
); long double complexcacoshl
( long double complexz
);
The cacosh()
functions
return the complex number whose hyperbolic cosine is equal to the
argument z
. The real part of the return
value is non-negative; the imaginary part is in the interval
[-πi, +πi].
Example
double complex v, z ;
double a = 0.0, b = 0.0;
puts("Calculate the inverse hyperbolic cosine of a complex number,"
" cacosh(z)\n");
puts("Enter the real and imaginary parts of a complex number:");
if ( scanf("%lf %lf", &a, &b) == 2)
{
z = a + b * I;
printf( "z = %.2f %+.2f*I.\n", creal(z), cimag(z) );
v =cacosh
(z);
printf( "The cacosh(z) function yields %.2f %+.2f*I.\n",
creal(v), cimag(v) );
printf( "The inverse function, ccosh(cacosh(z)), yields %.2f %+.2f*I.\n",
creal( ccosh(v)), cimag( ccosh(v)) );
}
else
printf("Invalid input.\n");
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.