Previous Page
Next Page


Calculates the inverse cosine of a complex number

#include <complex.h>
double complex cacos ( double complex z  );
float complex cacosf ( float complex z  );
long double complex cacosl ( long double complex z  );

The cacos( ) functions accept a complex number as their argument and return a complex number, but otherwise work the same as acos( ).


double complex v, z ;
double a = 0.0, b = 0.0;

puts("Calculate the arc cosine of a complex number, cacos(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 = cacos(z);
  printf( "The cacos(z) function yields %.2f %+.2f*I.\n",
          creal(v), cimag(v) );
  printf( "The inverse function, ccos(cacos(z)), yields %.2f %+.2f*I.\n",
          creal( ccos(v)), cimag( ccos(v)) );
  printf("Invalid input. \n");

See Also

ccos( ), csin( ), ctan( ), cacos( ), casin( ), catan( )

Previous Page
Next Page