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 y = ca‐
19 cos(z), then z = ccos(y). The real part of y is chosen in the interval
20 [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 at‐
31 tributes(7).
32
33 ┌────────────────────────────────────────────┬───────────────┬─────────┐
34 │Interface │ Attribute │ Value │
35 ├────────────────────────────────────────────┼───────────────┼─────────┤
36 │cacos(), cacosf(), cacosl() │ Thread safety │ MT-Safe │
37 └────────────────────────────────────────────┴───────────────┴─────────┘
38
40 C99, POSIX.1-2001, POSIX.1-2008.
41
43 /* Link with "-lm" */
44
45 #include <complex.h>
46 #include <stdlib.h>
47 #include <unistd.h>
48 #include <stdio.h>
49
50 int
51 main(int argc, char *argv[])
52 {
53 double complex z, c, f;
54 double complex i = I;
55
56 if (argc != 3) {
57 fprintf(stderr, "Usage: %s <real> <imag>\n", argv[0]);
58 exit(EXIT_FAILURE);
59 }
60
61 z = atof(argv[1]) + atof(argv[2]) * I;
62
63 c = cacos(z);
64
65 printf("cacos() = %6.3f %6.3f*i\n", creal(c), cimag(c));
66
67 f = -i * clog(z + i * csqrt(1 - z * z));
68
69 printf("formula = %6.3f %6.3f*i\n", creal(f), cimag(f));
70
71 exit(EXIT_SUCCESS);
72 }
73
75 ccos(3), clog(3), complex(7)
76
78 This page is part of release 5.13 of the Linux man-pages project. A
79 description of the project, information about reporting bugs, and the
80 latest version of this page, can be found at
81 https://www.kernel.org/doc/man-pages/.
82
83
84
85 2021-03-22 CACOS(3)