]> git.ipfire.org Git - thirdparty/man-pages.git/blame_incremental - man3/catan.3
signal.7: Note async-signal-safe functions added by POSIX.1-2008 TC1
[thirdparty/man-pages.git] / man3 / catan.3
... / ...
CommitLineData
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 2015-04-19 "" "Linux Programmer's Manual"
9.SH NAME
10catan, 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
20Link with \fI\-lm\fP.
21.SH DESCRIPTION
22These functions calculate the complex arc tangent of
23.IR z .
24If \fIy\ =\ catan(z)\fP, then \fIz\ =\ ctan(y)\fP.
25The real part of y is chosen in the interval [\-pi/2,pi/2].
26.LP
27One has:
28.nf
29
30 catan(z) = (clog(1 + i * z) \- clog(1 \- i * z)) / (2 * i)
31.fi
32.SH VERSIONS
33These functions first appeared in glibc in version 2.1.
34.SH ATTRIBUTES
35For an explanation of the terms used in this section, see
36.BR attributes (7).
37.TS
38allbox;
39lbw27 lb lb
40l l l.
41Interface Attribute Value
42T{
43.BR catan (),
44.BR catanf (),
45.BR catanl ()
46T} Thread safety MT-Safe
47.TE
48.SH CONFORMING TO
49C99, POSIX.1-2001, POSIX.1-2008.
50.SH EXAMPLE
51.nf
52/* Link with "\-lm" */
53
54#include <complex.h>
55#include <stdlib.h>
56#include <unistd.h>
57#include <stdio.h>
58
59int
60main(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>\\n", 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\\n", 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\\n", creal(f2), cimag(f2));
77
78 exit(EXIT_SUCCESS);
79}
80.fi
81.SH SEE ALSO
82.BR ccos (3),
83.BR clog (3),
84.BR ctan (3),
85.BR complex (7)