]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/catan.3
share/mk/: distcheck: Run 'check' after 'build'
[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 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
5 .\" Distributed under GPL
6 .\" %%%LICENSE_END
7 .\"
8 .TH CATAN 3 2019-03-06 "" "Linux Programmer's Manual"
9 .SH NAME
10 catan, catanf, catanl \- complex arc tangents
11 .SH SYNOPSIS
12 .B #include <complex.h>
13 .PP
14 .BI "double complex catan(double complex " z );
15 .br
16 .BI "float complex catanf(float complex " z );
17 .br
18 .BI "long double complex catanl(long double complex " z );
19 .PP
20 Link with \fI\-lm\fP.
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 .TS
38 allbox;
39 lbw27 lb lb
40 l l l.
41 Interface Attribute Value
42 T{
43 .BR catan (),
44 .BR catanf (),
45 .BR catanl ()
46 T} Thread safety MT-Safe
47 .TE
48 .SH CONFORMING TO
49 C99, POSIX.1-2001, POSIX.1-2008.
50 .SH EXAMPLE
51 .EX
52 /* Link with "\-lm" */
53
54 #include <complex.h>
55 #include <stdlib.h>
56 #include <unistd.h>
57 #include <stdio.h>
58
59 int
60 main(int argc, char *argv[])
61 {
62 double complex z, c, f;
63 double complex i = I;
64
65 if (argc != 3) {
66 fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]);
67 exit(EXIT_FAILURE);
68 }
69
70 z = atof(argv[1]) + atof(argv[2]) * I;
71
72 c = catan(z);
73 printf("catan() = %6.3f %6.3f*i\en", creal(c), cimag(c));
74
75 f = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i);
76 printf("formula = %6.3f %6.3f*i\en", creal(f2), cimag(f2));
77
78 exit(EXIT_SUCCESS);
79 }
80 .EE
81 .SH SEE ALSO
82 .BR ccos (3),
83 .BR clog (3),
84 .BR ctan (3),
85 .BR complex (7)