Debian Codegraph @

upstream/debian-trixie/man3/catan.3

raw
1 '\" t
2 .\" Copyright 2002 Walter Harms ([email protected])
3 .\" and Copyright (C) 2011 Michael Kerrisk <[email protected]>
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH catan 3 2024-06-15 "Linux man-pages 6.9.1"
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>
16 .P
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
26 .I y
27 is chosen in the interval [\-pi/2, pi/2].
28 .P
29 One has:
30 .P
31 .in +4n
32 .EX
33 catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
34 .EE
35 .in
36 .SH ATTRIBUTES
37 For an explanation of the terms used in this section, see
38 .BR attributes (7).
39 .TS
40 allbox;
41 lbx lb lb
42 l l l.
43 Interface Attribute Value
44 T{
45 .na
46 .nh
47 .BR catan (),
48 .BR catanf (),
49 .BR catanl ()
50 T} Thread safety MT-Safe
51 .TE
52 .SH STANDARDS
53 C11, POSIX.1-2008.
54 .SH HISTORY
55 glibc 2.1.
56 C99, POSIX.1-2001.
57 .SH EXAMPLES
58 .\" SRC BEGIN (catan.c)
59 .EX
60 /* Link with "\-lm" */
61 \&
62 #include <complex.h>
63 #include <stdio.h>
64 #include <stdlib.h>
65 #include <unistd.h>
66 \&
67 int
68 main(int argc, char *argv[])
69 {
70 double complex z, c, f;
71 double complex i = I;
72 \&
73 if (argc != 3) {
74 fprintf(stderr, "Usage: %s <real> <imag>\[rs]n", argv[0]);
75 exit(EXIT_FAILURE);
76 }
77 \&
78 z = atof(argv[1]) + atof(argv[2]) * I;
79 \&
80 c = catan(z);
81 printf("catan() = %6.3f %6.3f*i\[rs]n", creal(c), cimag(c));
82 \&
83 f = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i);
84 printf("formula = %6.3f %6.3f*i\[rs]n", creal(f), cimag(f));
85 \&
86 exit(EXIT_SUCCESS);
87 }
88 .EE
89 .\" SRC END
90 .SH SEE ALSO
91 .BR ccos (3),
92 .BR clog (3),
93 .BR ctan (3),
94 .BR complex (7)