1CATAN(3) Linux Programmer's Manual CATAN(3)
2
3
4
6 catan, catanf, catanl - complex arc tangents
7
9 #include <complex.h>
10
11 double complex catan(double complex z);
12 float complex catanf(float complex z);
13 long double complex catanl(long double complex z);
14
15 Link with -lm.
16
18 These functions calculate the complex arc tangent of z. If
19 y = catan(z), then z = ctan(y). The real part of y is chosen in the
20 interval [-pi/2,pi/2].
21
22 One has:
23
24 catan(z) = (clog(1 + i * z) - clog(1 - i * z)) / (2 * i)
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 │catan(), catanf(), catanl() │ 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 = catan(z);
64 printf("catan() = %6.3f %6.3f*i\n", creal(c), cimag(c));
65
66 f = (clog(1 + i * z) - clog(1 - i * z)) / (2 * i);
67 printf("formula = %6.3f %6.3f*i\n", creal(f2), cimag(f2));
68
69 exit(EXIT_SUCCESS);
70 }
71
73 ccos(3), clog(3), ctan(3), complex(7)
74
76 This page is part of release 5.12 of the Linux man-pages project. A
77 description of the project, information about reporting bugs, and the
78 latest version of this page, can be found at
79 https://www.kernel.org/doc/man-pages/.
80
81
82
83 2021-03-22 CATAN(3)