CONTRIBUTING.d/patches: Please provide a git-range-diff(1)
[man-pages.git] / man3 / catanh.3
blobf6749fe6cda3454ba73bb3c121c811a673ccbb00
1 '\" t
2 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" and Copyright (C) 2011 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH catanh 3 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 catanh, catanhf, catanhl \- complex arc tangents hyperbolic
10 .SH LIBRARY
11 Math library
12 .RI ( libm ", " \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B #include <complex.h>
17 .BI "double complex catanh(double complex " z );
18 .BI "float complex catanhf(float complex " z );
19 .BI "long double complex catanhl(long double complex " z );
20 .fi
21 .SH DESCRIPTION
22 These functions calculate the complex arc hyperbolic tangent of
23 .IR z .
24 If \fIy\~=\~catanh(z)\fP, then \fIz\~=\~ctanh(y)\fP.
25 The imaginary part of
26 .I y
27 is chosen in the interval [\-pi/2,pi/2].
29 One has:
31 .in +4n
32 .EX
33 catanh(z) = 0.5 * (clog(1 + z) \- clog(1 \- z))
34 .EE
35 .in
36 .SH ATTRIBUTES
37 For an explanation of the terms used in this section, see
38 .BR attributes (7).
39 .TS
40 allbox;
41 lbx lb lb
42 l l l.
43 Interface       Attribute       Value
45 .na
46 .nh
47 .BR catanh (),
48 .BR catanhf (),
49 .BR catanhl ()
50 T}      Thread safety   MT-Safe
51 .TE
52 .SH STANDARDS
53 C11, POSIX.1-2008.
54 .SH HISTORY
55 glibc 2.1.
56 C99, POSIX.1-2001.
57 .SH EXAMPLES
58 .\" SRC BEGIN (catanh.c)
59 .EX
60 /* Link with "\-lm" */
62 #include <complex.h>
63 #include <stdio.h>
64 #include <stdlib.h>
65 #include <unistd.h>
67 int
68 main(int argc, char *argv[])
70     double complex z, c, f;
72     if (argc != 3) {
73         fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]);
74         exit(EXIT_FAILURE);
75     }
77     z = atof(argv[1]) + atof(argv[2]) * I;
79     c = catanh(z);
80     printf("catanh() = %6.3f %6.3f*i\en", creal(c), cimag(c));
82     f = 0.5 * (clog(1 + z) \- clog(1 \- z));
83     printf("formula  = %6.3f %6.3f*i\en", creal(f), cimag(f));
85     exit(EXIT_SUCCESS);
87 .EE
88 .\" SRC END
89 .SH SEE ALSO
90 .BR atanh (3),
91 .BR cabs (3),
92 .BR cimag (3),
93 .BR ctanh (3),
94 .BR complex (7)