OSDN Git Service

f64463541f77c637211024762c04664891aa2e80
[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 .\"
4 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
5 .\" Distributed under GPL
6 .\" %%%LICENSE_END
7 .\"
8 .TH CATAN 3 2011-09-15 "" "Linux Programmer's Manual"
9 .SH NAME
10 catan, catanf, catanl \- complex arc tangents
11 .SH SYNOPSIS
12 .B #include <complex.h>
13 .sp
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 .sp
20 Link with \fI\-lm\fP.
21 .SH DESCRIPTION
22 The
23 .BR catan ()
24 function calculates the complex arc tangent of
25 .IR z .
26 If \fIy\ =\ catan(z)\fP, then \fIz\ =\ ctan(y)\fP.
27 The real part of y is chosen in the interval [\-pi/2,pi/2].
28 .LP
29 One has:
30 .nf
31
32     catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
33 .fi
34 .SH VERSIONS
35 These functions first appeared in glibc in version 2.1.
36 .SH CONFORMING TO
37 C99.
38 .SH EXAMPLE
39 .nf
40 /* Link with "\-lm" */
41
42 #include <complex.h>
43 #include <stdlib.h>
44 #include <unistd.h>
45 #include <stdio.h>
46
47 int
48 main(int argc, char *argv[])
49 {
50     double complex z, c, f;
51     double complex i = I;
52
53     if (argc != 3) {
54         fprintf(stderr, "Usage: %s <real> <imag>\\n", argv[0]);
55         exit(EXIT_FAILURE);
56     }
57
58     z = atof(argv[1]) + atof(argv[2]) * I;
59
60     c = catan(z);
61     printf("catan() = %6.3f %6.3f*i\\n", creal(c), cimag(c));
62
63     f = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i);
64     printf("formula = %6.3f %6.3f*i\\n", creal(f2), cimag(f2));
65
66     exit(EXIT_SUCCESS);
67 }
68 .fi
69 .SH SEE ALSO
70 .BR ccos (3),
71 .BR clog (3),
72 .BR ctan (3),
73 .BR complex (7)
74 .SH COLOPHON
75 This page is part of release 3.64 of the Linux
76 .I man-pages
77 project.
78 A description of the project,
79 and information about reporting bugs,
80 can be found at
81 \%http://www.kernel.org/doc/man\-pages/.