malloc_get_state.3: tfix
[man-pages.git] / man3 / catan.3
blobb928b9d0e83d25843af0ff750b8f9e19b3e4e8e9
1 '\" t
2 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" and Copyright (C) 2011 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH catan 3 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 catan, catanf, catanl \- complex arc tangents
10 .SH LIBRARY
11 Math library
12 .RI ( libm ", " \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B #include <complex.h>
17 .BI "double complex catan(double complex " z );
18 .BI "float complex catanf(float complex " z );
19 .BI "long double complex catanl(long double complex " z );
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].
27 One has:
29 .in +4n
30 .EX
31 catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
32 .EE
33 .in
34 .SH ATTRIBUTES
35 For an explanation of the terms used in this section, see
36 .BR attributes (7).
37 .TS
38 allbox;
39 lbx lb lb
40 l l l.
41 Interface       Attribute       Value
43 .na
44 .nh
45 .BR catan (),
46 .BR catanf (),
47 .BR catanl ()
48 T}      Thread safety   MT-Safe
49 .TE
50 .SH STANDARDS
51 C11, POSIX.1-2008.
52 .SH HISTORY
53 glibc 2.1.
54 C99, POSIX.1-2001.
55 .SH EXAMPLES
56 .\" SRC BEGIN (catan.c)
57 .EX
58 /* Link with "\-lm" */
60 #include <complex.h>
61 #include <stdio.h>
62 #include <stdlib.h>
63 #include <unistd.h>
65 int
66 main(int argc, char *argv[])
68     double complex z, c, f;
69     double complex i = I;
71     if (argc != 3) {
72         fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]);
73         exit(EXIT_FAILURE);
74     }
76     z = atof(argv[1]) + atof(argv[2]) * I;
78     c = catan(z);
79     printf("catan() = %6.3f %6.3f*i\en", creal(c), cimag(c));
81     f = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i);
82     printf("formula = %6.3f %6.3f*i\en", creal(f), cimag(f));
84     exit(EXIT_SUCCESS);
86 .EE
87 .\" SRC END
88 .SH SEE ALSO
89 .BR ccos (3),
90 .BR clog (3),
91 .BR ctan (3),
92 .BR complex (7)