OSDN Git Service

(split) LDP_man-pages: update original to v3.34.
[linuxjm/LDP_man-pages.git] / original / man3 / catan.3
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" and Copyright (C) 2011 Michael Kerrisk <mtk.manpages@gamil.com>
3 .\" Distributed under GPL
4 .\"
5 .TH CATAN 3 2011-09-15 "" "Linux Programmer's Manual"
6 .SH NAME
7 catan, catanf, catanl \- complex arc tangents
8 .SH SYNOPSIS
9 .B #include <complex.h>
10 .sp
11 .BI "double complex catan(double complex " z );
12 .br
13 .BI "float complex catanf(float complex " z );
14 .br
15 .BI "long double complex catanl(long double complex " z );
16 .sp
17 Link with \fI\-lm\fP.
18 .SH DESCRIPTION
19 The
20 .BR catan ()
21 function calculates 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 .LP
26 One has:
27 .nf
28
29     catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
30 .fi
31 .SH VERSIONS
32 These functions first appeared in glibc in version 2.1.
33 .SH "CONFORMING TO"
34 C99.
35 .SH EXAMPLE
36 .nf
37 /* Link with "\-lm" */
38
39 #include <complex.h>
40 #include <stdlib.h>
41 #include <unistd.h>
42 #include <stdio.h>
43
44 int
45 main(int argc, char *argv[])
46 {
47     double complex z, c, f;
48     double complex i = I;
49
50     if (argc != 3) {
51         fprintf(stderr, "Usage: %s <real> <imag>\\n", argv[0]);
52         exit(EXIT_FAILURE);
53     }
54
55     z = atof(argv[1]) + atof(argv[2]) * I;
56
57     c = catan(z);
58     printf("catan() = %6.3f %6.3f*i\\n", creal(c), cimag(c));
59
60     f = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i);
61     printf("formula = %6.3f %6.3f*i\\n", creal(f2), cimag(f2));
62
63     exit(EXIT_SUCCESS);
64 }
65 .fi
66 .SH "SEE ALSO"
67 .BR ccos (3),
68 .BR clog (3),
69 .BR ctan (3),
70 .BR complex (7)