1cacos(3) Library Functions Manual cacos(3)
2
3
4
6 cacos, cacosf, cacosl - complex arc cosine
7
9 Math library (libm, -lm)
10
12 #include <complex.h>
13
14 double complex cacos(double complex z);
15 float complex cacosf(float complex z);
16 long double complex cacosl(long double complex z);
17
19 These functions calculate the complex arc cosine of z. If y = ca‐
20 cos(z), then z = ccos(y). The real part of y is chosen in the interval
21 [0,pi].
22
23 One has:
24
25 cacos(z) = -i * clog(z + i * csqrt(1 - z * z))
26
28 For an explanation of the terms used in this section, see at‐
29 tributes(7).
30
31 ┌────────────────────────────────────────────┬───────────────┬─────────┐
32 │Interface │ Attribute │ Value │
33 ├────────────────────────────────────────────┼───────────────┼─────────┤
34 │cacos(), cacosf(), cacosl() │ Thread safety │ MT-Safe │
35 └────────────────────────────────────────────┴───────────────┴─────────┘
36
38 C11, POSIX.1-2008.
39
41 glibc 2.1. C99, POSIX.1-2001.
42
44 /* Link with "-lm" */
45
46 #include <complex.h>
47 #include <stdio.h>
48 #include <stdlib.h>
49 #include <unistd.h>
50
51 int
52 main(int argc, char *argv[])
53 {
54 double complex z, c, f;
55 double complex i = I;
56
57 if (argc != 3) {
58 fprintf(stderr, "Usage: %s <real> <imag>\n", argv[0]);
59 exit(EXIT_FAILURE);
60 }
61
62 z = atof(argv[1]) + atof(argv[2]) * I;
63
64 c = cacos(z);
65
66 printf("cacos() = %6.3f %6.3f*i\n", creal(c), cimag(c));
67
68 f = -i * clog(z + i * csqrt(1 - z * z));
69
70 printf("formula = %6.3f %6.3f*i\n", creal(f), cimag(f));
71
72 exit(EXIT_SUCCESS);
73 }
74
76 ccos(3), clog(3), complex(7)
77
78
79
80Linux man-pages 6.04 2023-03-30 cacos(3)