# C complex.h cacos,cacosf and cacosl

The C <complex.h> cacos,cacosf and cacosl functions compute the arc cosine of the complex number.The declaration of the is given below.

1 double complex cacos(double complex z);
2 float complex cacosf(float complex z);
3 long double complex cacosl(long double complex z);

All the three functions compute the same value,the only difference between them is in their return type:

i)The ‘cacos’ return the arc cosine as double complex type.
ii)The ‘cacosf’ return the arc cosine as float complex type and
iii)The ‘cacosl’ return the arc cosine as long double complex type.

Some points to note:

i) The arc cosine function is given by :

ii) The real part of arc cosine computed complex number is outputted in the interval [0 , π].But the imaginary value is unbound.

#### double complex cacos(double complex z);

Parameters:
z -The complex number whose arc cosine is to be computed.

Return type
double complex -The arc cosine complex number.

Code example

double complex c1=9.506 + I*3.5 , c2;

c2=cacos( c1 );

printf( “Real part of c2=%lf” , creal(c2) );
printf( “\nImaginary part of c2=%lf” , cimag(c2) );

Output,

Realpart of the c2=0.354374
Imaginary part of c2=-3.006779

#### float complex cacosf(float complex z);

Parameters:
z -The complex number whose arc cosine is to be computed.

Return type
float complex -The arc cosine complex number.

Code example

float complex c1=9.506 + I*3.5 , c2 ;

c2=cacosf( c1 );

printf( “Real part of c2=%f” , crealf(c2) );
printf( “\nImaginary part of c2=%f” , cimagf(c2) );

Output,

Realpart of the c2=0.354376
Imaginary part of c2=-3.006776

#### long double complex cacosl(long double complex z);

Parameters:
z -The complex number whose arc cosine is to be computed.

Return type
long double complex -The arc cosine complex number.

Code example

long double complex c1=9.506 + I*3.5 , c2 ;

c2=cacosl( c1 );

printf( “Real part of c2=%Lf” , creall(c2) );
printf( “\nImaginary part of c2=%Lf” , cimagl(c2) );

Output,

Realpart of the c2=0.354376
Imaginary part of c2=-3.006776

As you can see whether we use cacos or cacosf or cacosl the result remains the same.

*Side Note

Some cases of cacos function(also hold stru for cacosf and cacosl),

➥cacos(conj(z) )=conj( cacos(z) )

➥cacos(±0 + i0) ,returns π/2− i0

➥cacos(±0 + iNaN) ,returns π/2+iNaN.

➥cacos(x + i∞) , returns π/2 − i∞ ,for finite x.

➥cacos(x + iNaN) ,returns NaN + iNaN and optionally raises the invalid floating-point exception, for nonzero finite x.

➥cacos(−∞ + iy) returns π−i∞, for positive-signed finite y.

➥cacos(+∞ +iy) ,returns +0−i∞ ,for positive-signed finite y.

➥cacos(−∞ + i∞) ,returns 3π/4 −i∞.

➥cacos(+∞ + i∞) ,returns π/4−i∞ .

➥cacos(±∞ + iNaN) ,returns NaN±i∞ , (where the sign of the imaginary part of the result is unspecified).

➥cacos(NaN + iy) ,returns NaN +iNaN and optionally raises the invalid floating-point exception, for finite y.

➥cacos(NaN + i∞) ,returns NaN−i∞

➥cacos(NaN + iNaN) ,returns NaN+iNaN