1CACOS(3) Linux Programmer's Manual CACOS(3)
2
3
4
6 cacos, cacosf, cacosl - complex arc cosine
7
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
18 These functions calculate 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
27 These functions first appeared in glibc in version 2.1.
28
30 For an explanation of the terms used in this section, see
31 attributes(7).
32
33 ┌─────────────────────────────┬───────────────┬─────────┐
34 │Interface │ Attribute │ Value │
35 ├─────────────────────────────┼───────────────┼─────────┤
36 │cacos(), cacosf(), cacosl() │ Thread safety │ MT-Safe │
37 └─────────────────────────────┴───────────────┴─────────┘
39 C99, POSIX.1-2001, POSIX.1-2008.
40
42 /* Link with "-lm" */
43
44 #include <complex.h>
45 #include <stdlib.h>
46 #include <unistd.h>
47 #include <stdio.h>
48
49 int
50 main(int argc, char *argv[])
51 {
52 double complex z, c, f;
53 double complex i = I;
54
55 if (argc != 3) {
56 fprintf(stderr, "Usage: %s <real> <imag>\n", argv[0]);
57 exit(EXIT_FAILURE);
58 }
59
60 z = atof(argv[1]) + atof(argv[2]) * I;
61
62 c = cacos(z);
63
64 printf("cacos() = %6.3f %6.3f*i\n", creal(c), cimag(c));
65
66 f = -i * clog(z + i * csqrt(1 - z * z));
67
68 printf("formula = %6.3f %6.3f*i\n", creal(f), cimag(f));
69
70 exit(EXIT_SUCCESS);
71 }
72
74 ccos(3), clog(3), complex(7)
75
77 This page is part of release 4.15 of the Linux man-pages project. A
78 description of the project, information about reporting bugs, and the
79 latest version of this page, can be found at
80 https://www.kernel.org/doc/man-pages/.
81
82
83
84 2015-04-19 CACOS(3)