# C complex.h catan,catanf and catanl

The C++ <complex.h> catan, catanf and catanl functions compute the arc tangent of a complex number.The declaration of the asin function is given below.

1 double complex catan(double complex z);
2 float complex catanf(float complex z);
3 long double complex catanl(long double complex z);

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

i)The ‘catan’ return the arc tangent as double complex type.
ii)The ‘catanf’ return the arc tangent as float complex type and
iii)The ‘catanl’ return the arc tangent as long double complex type.

Some points to note:

i) The arc tangent function is computed using the formula (‘x’ is any complex number).

ii)The real number of an arc sine computed complex number is outputted in the interval [-π/2 , π/2].But the imaginary value is unbound.

#### double complex catan(double complex z);

Parameters:
z – A complex number for which arc tangent is to be computed.

Return type
double complex -The arc tangent of ‘z’ complex number as double type.

Code example

double complex c1=74576.6548+I*535 , c2 ;

c2=catan( c1 ) ;

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

Output,

Real part of c2=1.570783
Imaginary part of c2=0.000000

#### float complex catanf(float complex z);

This function compute the arc tangent and return it as float complex type.

Parameters:
z – A complex number for which arc tangent is to be computed.

Return type
float complex -The arc tangent of ‘z’ complex number as float type.

Code example

double complex c1=74576.6548+I*535 , c2 ;

c2=catanf( c1 ) ; //may result in loss of precision

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

Output,

Real part of c2=1.570783
Imaginary part of c2=-0.000000

Teh complex number c1 is a double type but catanf returns a complex number of float type,converting from double to float may result in loss of precision ,you better be careful with such programming method.

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

This function compute the arc tangent and return it as long double complex type.

Parameters:
z – A complex number for which arc tangent is to be computed.

Return type
long double complex -The arc tangent of ‘z’ complex number as long double type.

long double complex c1=74576.6548+I*535 , c2 ;

c2=catanl( c1 ) ;

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

Output,

Real part of c2=1.570783
Imaginary part of c2=-0.000000

*Side Note

Some cases of catan function (also holds true for catanf and catanl),

➥catan( conj(z) )=cc\onj( catan(z) )

➥catan(±0 + i(±0)) ,returns (±0 , i(±0)).

➥catan(±0 + iNaN) ,returns (nan , inan).

➥catan(±x + i(±∞) ) , returns ±π/2 + i(±0) ,for finite x.

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

➥catan(±∞ + iy) returns ±π/2 + i0, for positive-signed finite y.

➥catan(±∞ + i∞) ,returns ±π/2 +i0.

➥catan(±∞ + iNaN) ,returns ±π/2+i0.

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

➥catan(NaN + i(±)∞) ,returns NaN + iNaN .

➥catan(NaN + iNaN) ,returns NaN+iNaN.