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