1catan(3) Library Functions Manual catan(3)
2
3
4
6 catan, catanf, catanl - complex arc tangents
7
9 Math library (libm, -lm)
10
12 #include <complex.h>
13
14 double complex catan(double complex z);
15 float complex catanf(float complex z);
16 long double complex catanl(long double complex z);
17
19 These functions calculate the complex arc tangent of z. If
20 y = catan(z), then z = ctan(y). The real part of y is chosen in the
21 interval [-pi/2,pi/2].
22
23 One has:
24
25 catan(z) = (clog(1 + i * z) - clog(1 - i * z)) / (2 * i)
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 │catan(), catanf(), catanl() │ 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 = catan(z);
65 printf("catan() = %6.3f %6.3f*i\n", creal(c), cimag(c));
66
67 f = (clog(1 + i * z) - clog(1 - i * z)) / (2 * i);
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), ctan(3), complex(7)
75
76
77
78Linux man-pages 6.04 2023-03-30 catan(3)