cacos(), cacosf(), cacosl() — Calculate the complex arc cosine

Standards

Standards / Extensions C or C++ Dependencies

C99
Single UNIX Specification, Version 3

both

z/OS V1R7
a compiler that is designed
to support C99

Format

#include <complex.h>

double complex cacos(double complex z);
float complex cacosf(float complex z);
long double complex cacosl(long double complex z);

General description

The cacos() family of functions compute the complex arc cosine of z, with branch cuts outside the interval [-1, +1] along the real axis.
Note: The following table shows the viable formats for these functions. See IEEE binary floating-point for more information about IEEE Binary Floating-Point.
Function Hex IEEE
cacos X X
cacosf X X
cacosl X X

Returned value

The cacos() family of functions return the complex arc cosine value, in the range of a strip, mathematically unbounded along the imaginary axis and in the interval [0, π] along the real axis.

Example

/*
 *  This example calculates the complex arc-cosine of
 *  complex number 'z'
 */
#include <complex.h>
#include <stdio.h>

void main()
{

   long double complex zl=3.5 + I*2.21;
   double complex zd=(double complex)zl;
   float complex zf=(float complex)zl;
   long double resl;
   double resd;
   float resf;
   char *func = "cacos";

   printf("Example of the %s complex function\n",func);
   resd = cacos(zd);
   resf = cacosf(zf);
   resl = cacosl(zl);
   printf("\t%s(%f + I*%f) = %f\n",func, creal(zd), cimag(zd),resd);
   printf("\t%sf(%f + I*%f) = %f\n",func, crealf(zf), cimagf(zf),resf);
   printf("\t%sl(%Lf + I*%Lf) = %Lf\n",func, creall(zl), cimagl(zl),resl);
}
	

Output:

Example of the cacos complex function
        cacos(3.500000 + I*2.210000) = 0.576628
        cacosf(3.500000 + I*2.209999) = 0.576627
        cacosl(3.500000 + I*2.210000) = 0.576628

Related information