Namespaces
Variants
Views
Actions

csinf, csin, csinl

From cppreference.com
< c‎ | numeric‎ | complex
Revision as of 06:10, 11 February 2014 by Newatthis (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Defined in header <complex.h>
float complex       csinf( float complex z );
(since C99)
double complex      csin( double complex z );
(since C99)
long double complex csinl( long double complex z );
(since C99)

Computes the complex sine of z.

Contents

[edit] Parameters

z - complex argument

[edit] Return value

The complex sine of z.

[edit] Example

#include <stdio.h>
#include <complex.h>
#include <math.h>
 
#define PI acos(-1)
 
int main()
{
    double complex z;
    double x;
 
    /* Print familiar values. */
    int ndx;
    printf("            sin(x)          csin(z)\n");
    printf("           --------    ------------------\n");
    for (ndx=0;ndx<9;ndx++) {
        x = ndx*0.25*PI;
        z = x+0.0*I;
        z = csin(z);
        printf("%.2f*PI   %9f   %9f%+fi\n", ndx*0.25,sin(x),creal(z),cimag(z));
    }
 
    return 0;
}

Output:

sin(x)          csin(z)
           --------    ------------------
0.00*PI    0.000000    0.000000+0.000000i
0.25*PI    0.707107    0.707107+0.000000i
0.50*PI    1.000000    1.000000+0.000000i
0.75*PI    0.707107    0.707107-0.000000i
1.00*PI    0.000000    0.000000-0.000000i
1.25*PI   -0.707107   -0.707107-0.000000i
1.50*PI   -1.000000   -1.000000-0.000000i
1.75*PI   -0.707107   -0.707107+0.000000i
2.00*PI   -0.000000   -0.000000+0.000000i

[edit] See also

(C99)(C99)(C99)
computes the complex cosine
(function) [edit]
(C99)(C99)(C99)
computes the complex tangent
(function) [edit]