ccosf, ccos, ccosl - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# ccosf, ccos, ccosl

From cppreference.com
< c‎ | numeric‎ | complex

Defined in header `<complex.h>` |  |
float complex ccosf( float complex z ); |  | (since C99)
double complex ccos( double complex z ); |  | (since C99)
long double complex ccosl( long double complex z ); |  | (since C99)

Computes the complex cosine of `z`.

### [edit] Parameters

z | - | complex argument

### [edit] Return value

The complex cosine of `z`.

### [edit] Example

Run this code

    #include <stdio.h>
    #include <complex.h>
    #include <math.h>

    #define PI acos(-1)

    int main(void)
    {
        double complex z;
        double x;

        /* Print familiar values. */
        int ndx;
        printf("            cos(x)          ccos(z)\n");
        printf("           --------    ------------------\n");
        for (ndx=0;ndx<9;ndx++) {
            x = ndx*0.25*PI;
            z = x+0.0*I;
            z = ccos(z);
            printf("%.2f*PI   %9f   %9f%+fi\n", ndx*0.25,cos(x),creal(z),cimag(z));
        }

        return 0;
    }

Output:

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

### [edit] See also

csincsinfcsinl (C99)(C99)(C99) | computes the complex sine (function) [edit]
ctanctanfctanl (C99)(C99)(C99) | computes the complex tangent (function) [edit]
cacoscacosfcacosl (C99)(C99)(C99) | computes the complex arc cosine (function) [edit]
coscosfcosl (C99)(C99) | computes cosine (cos(x)) (function) [edit]
C++ documentation for cos

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/numeric/complex/ccos&oldid=70578"