# C complex.h ctan,ctanf and ctanl

The C <complex.h> ctan,ctanf and ctanl function compute the tangent of the complex number.The declaration of the function is given below.

1 double complex ctan(double complex z);
2 float complex ctanf(float complex z);
3 long double complex ctanl(long double complex z);

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

i)The ‘ctan’ return the tangent as double complex type.
ii)The ‘ctanf’ return the tangent as float complex type and
iii)The ‘ctanl’ return the tangent as long double complex type.

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

**Note:
sin(z)=csin(z)=csinf(z)=csinl(z)
cos(z)=ccos(z)=ccosf(z)=ccosl(z)

#### double complex ctan(double complex z);

Parameters:
z – A complex number whose tangent is to be computed.

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

Code example

double complex c1=83.5 +I*6.13 , c2 ;

c2=ctan( c1 ) ;

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

Output,

Real part of c2=-0.000005
Imaginary part of c2=1.000008

#### float complex ctanf(float complex z);

This function return the tangent of complex number as float type.

Parameters:
z – A complex number whose tangent is to be computed.

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

Code example

double complex c1=83.5 +I*6.13 , c2 ;

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

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

Output,

Real part of c2=-0.000005
Imaginary part of c2=1.000008

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

This function return the tangent of complex number as long double type.

Parameters:
z – A complex number whose tangent is to be computed.

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

Code example

long double complex c1=83.5 +I*6.13 , c2 ;

c2=ctanl( c1 ) ;

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

Output,

Real part of c2=-0.000005
Imaginary part of c2=1.000008

*Side Note

Some cases of ctan function (also holds true for ctanf and ctanl),

➥ctan(conj(z) )=conj( ctan(z) ).

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

➥ctan(±0 + iNaN) ,returns (±0 , iNaN).

➥ctan(x + i∞ ) , returns (±0 ,i(±1) ),for some finite value ‘x’.

➥ctan(±x + iNaN) ,returns NaN + iNaN,for some finite value ‘x’.

➥ctan(±∞ + iy) ,returns NaN + iNaN ,for some finite value ‘y’.

➥ctan(±∞ + i∞) ,returns (±0 , i(±1)).

➥ctan(±∞ + iNaN) ,returns NaN +iNaN

➥ctan(NaN + iy) ,returns NaN +iNaN ,for some finite value ‘y’.

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

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