readv.2, pthread_tryjoin_np.3, stailq.3, strlen.3, wcslen.3: Arrange .SH sections...
[man-pages.git] / man3 / catan.3
blob22de9567aa39772db36df749cf48676be11df19b
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" and Copyright (C) 2011 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
5 .\" Distributed under GPL
6 .\" %%%LICENSE_END
7 .\"
8 .TH CATAN 3 2021-03-22 "" "Linux Programmer's Manual"
9 .SH NAME
10 catan, catanf, catanl \- complex arc tangents
11 .SH SYNOPSIS
12 .nf
13 .B #include <complex.h>
14 .PP
15 .BI "double complex catan(double complex " z );
16 .BI "float complex catanf(float complex " z );
17 .BI "long double complex catanl(long double complex " z );
18 .PP
19 Link with \fI\-lm\fP.
20 .fi
21 .SH DESCRIPTION
22 These functions calculate the complex arc tangent of
23 .IR z .
24 If \fIy\ =\ catan(z)\fP, then \fIz\ =\ ctan(y)\fP.
25 The real part of y is chosen in the interval [\-pi/2,pi/2].
26 .PP
27 One has:
28 .PP
29 .nf
30     catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
31 .fi
32 .SH VERSIONS
33 These functions first appeared in glibc in version 2.1.
34 .SH ATTRIBUTES
35 For an explanation of the terms used in this section, see
36 .BR attributes (7).
37 .ad l
38 .nh
39 .TS
40 allbox;
41 lbx lb lb
42 l l l.
43 Interface       Attribute       Value
45 .BR catan (),
46 .BR catanf (),
47 .BR catanl ()
48 T}      Thread safety   MT-Safe
49 .TE
50 .hy
51 .ad
52 .sp 1
53 .SH CONFORMING TO
54 C99, POSIX.1-2001, POSIX.1-2008.
55 .SH EXAMPLES
56 .EX
57 /* Link with "\-lm" */
59 #include <complex.h>
60 #include <stdlib.h>
61 #include <unistd.h>
62 #include <stdio.h>
64 int
65 main(int argc, char *argv[])
67     double complex z, c, f;
68     double complex i = I;
70     if (argc != 3) {
71         fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]);
72         exit(EXIT_FAILURE);
73     }
75     z = atof(argv[1]) + atof(argv[2]) * I;
77     c = catan(z);
78     printf("catan() = %6.3f %6.3f*i\en", creal(c), cimag(c));
80     f = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i);
81     printf("formula = %6.3f %6.3f*i\en", creal(f2), cimag(f2));
83     exit(EXIT_SUCCESS);
85 .EE
86 .SH SEE ALSO
87 .BR ccos (3),
88 .BR clog (3),
89 .BR ctan (3),
90 .BR complex (7)