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 The catan() function calculates 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 C99.
31
33 /* Link with "-lm" */
34
35 #include <complex.h>
36 #include <stdlib.h>
37 #include <unistd.h>
38 #include <stdio.h>
39
40 int
41 main(int argc, char *argv[])
42 {
43 double complex z, c, f;
44 double complex i = I;
45
46 if (argc != 3) {
47 fprintf(stderr, "Usage: %s <real> <imag>\n", argv[0]);
48 exit(EXIT_FAILURE);
49 }
50
51 z = atof(argv[1]) + atof(argv[2]) * I;
52
53 c = catan(z);
54 printf("catan() = %6.3f %6.3f*i\n", creal(c), cimag(c));
55
56 f = (clog(1 + i * z) - clog(1 - i * z)) / (2 * i);
57 printf("formula = %6.3f %6.3f*i\n", creal(f2), cimag(f2));
58
59 exit(EXIT_SUCCESS);
60 }
61
63 ccos(3), clog(3), ctan(3), complex(7)
64
66 This page is part of release 3.53 of the Linux man-pages project. A
67 description of the project, and information about reporting bugs, can
68 be found at http://www.kernel.org/doc/man-pages/.
69
70
71
72 2011-09-15 CATAN(3)