1CACOS(3)                   Linux Programmer's Manual                  CACOS(3)
2
3
4

NAME

6       cacos, cacosf, cacosl - complex arc cosine
7

SYNOPSIS

9       #include <complex.h>
10
11       double complex cacos(double complex z);
12       float complex cacosf(float complex z);
13       long double complex cacosl(long double complex z);
14
15       Link with -lm.
16

DESCRIPTION

18       The  cacos()  function  calculates  the  complex  arc  cosine of z.  If
19       y = cacos(z), then z = ccos(y).  The real part of y is  chosen  in  the
20       interval [0,pi].
21
22       One has:
23
24           cacos(z) = -i * clog(z + i * csqrt(1 - z * z))
25

VERSIONS

27       These functions first appeared in glibc in version 2.1.
28

CONFORMING TO

30       C99.
31

EXAMPLE

33       /* Link with "-lm" */
34
35       #include <complex.h>
36       #include <stdlib.h>
37       #include <unistd.h>
38       #include <stdio.h>
39
40       int
41       main(int argc, char *argv[])
42       {
43           double complex z, c, f;
44           double complex i = I;
45
46           if (argc != 3) {
47               fprintf(stderr, "Usage: %s <real> <imag>\n", argv[0]);
48               exit(EXIT_FAILURE);
49           }
50
51           z = atof(argv[1]) + atof(argv[2]) * I;
52
53           c = cacos(z);
54
55           printf("cacos() = %6.3f %6.3f*i\n", creal(c), cimag(c));
56
57           f = -i * clog(z + i * csqrt(1 - z * z));
58
59           printf("formula = %6.3f %6.3f*i\n", creal(f), cimag(f));
60
61           exit(EXIT_SUCCESS);
62       }
63

SEE ALSO

65       ccos(3), clog(3), complex(7)
66

COLOPHON

68       This  page  is  part of release 3.53 of the Linux man-pages project.  A
69       description of the project, and information about reporting  bugs,  can
70       be found at http://www.kernel.org/doc/man-pages/.
71
72
73
74                                  2011-09-15                          CACOS(3)
Impressum