C complex.h csin,csinf and csinl


The C <complex.h> csin,csinf and csinl functions compute the sine of the complex number.The declaration of the function is given below.

1 double complex csin(double complex z);
2 float complex csinf(float complex z);
3 long double complex csinl(long double complex z);

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

i)The ‘csin’ return the sine as double complex type.
ii)The ‘csinf’ return the sine as float complex type and
iii)The ‘csinl’ return the sine as long double complex type.

Some points to note:

i) The sine is computed using the formula.

C complex.h csin,csinf and csinl

double complex csin(double complex z);

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

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

Code example

double complex c1=63.45 +I*1.3 , c2 ;

c2=ccos( c1 ) ;

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

Output,

Real part of c2=1.142196
Imaginary part of c2=1.384103





float complex csinf(float complex z);

This function compute the sine of the complex number and return it as float complex type.

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

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

Code example

float complex c1=63.45 +I*1.3 , c2 ;

c2=ccosf( c1 ) ;

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

Output,

Real part of c2=1.142196
Imaginary part of c2=1.384103


long double complex csinl(long double complex z);

This function compute the sine of the complex number and return it as long double complex type.

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

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

Code example

long double complex c1=63.45 +I*1.3 , c2 ;

c2=ccosl( c1 ) ;

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

Output,

Real part of c2=1.142196
Imaginary part of c2=1.384103

You can see that all the three functions csin,csinf and csinl return the same value the only dissimilarity is in their return type.

Link : C complex.h creal,crealf and creall
Link : C complex.h cimag,cimagf and cimagl


*Side Note

Some cases of csin function (also holds true for csinf and csinl),

  ➥csin(conj(z) )=conj( csin(z) )

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

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

  ➥csin(x + i∞ ) , returns (-∞ ,i(-∞) ),for some finite value ‘x’.

  ➥csin(-x – i∞ ) , returns (∞ , i∞ ) ,for some finite value ‘x’.

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

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

  ➥csin(±∞ + i∞) ,returns (NaN , i(-∞)).

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

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

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

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

Link :C complex.h conj,conjf and conjl