README: Update links
[man-pages.git] / man3 / cacosh.3
blobc6b3a2067dd18802df136af68aeeb648aacf9d6e
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 cacosh 3 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 cacosh, cacoshf, cacoshl \- complex arc hyperbolic cosine
10 .SH LIBRARY
11 Math library
12 .RI ( libm ", " \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B #include <complex.h>
17 .BI "double complex cacosh(double complex " z );
18 .BI "float complex cacoshf(float complex " z );
19 .BI "long double complex cacoshl(long double complex " z );
20 .fi
21 .SH DESCRIPTION
22 These functions calculate the complex arc hyperbolic cosine of
23 .IR z .
24 If \fIy\ =\ cacosh(z)\fP, then \fIz\ =\ ccosh(y)\fP.
25 The imaginary part of
26 .I y
27 is chosen in the interval [\-pi,pi].
28 The real part of
29 .I y
30 is chosen nonnegative.
32 One has:
34 .nf
35     cacosh(z) = 2 * clog(csqrt((z + 1) / 2) + csqrt((z \- 1) / 2))
36 .fi
37 .SH ATTRIBUTES
38 For an explanation of the terms used in this section, see
39 .BR attributes (7).
40 .TS
41 allbox;
42 lbx lb lb
43 l l l.
44 Interface       Attribute       Value
46 .na
47 .nh
48 .BR cacosh (),
49 .BR cacoshf (),
50 .BR cacoshl ()
51 T}      Thread safety   MT-Safe
52 .TE
53 .SH STANDARDS
54 C11, POSIX.1-2008.
55 .SH HISTORY
56 C99, POSIX.1-2001.
57 glibc 2.1.
58 .SH EXAMPLES
59 .\" SRC BEGIN (cacosh.c)
60 .EX
61 /* Link with "\-lm" */
63 #include <complex.h>
64 #include <stdio.h>
65 #include <stdlib.h>
66 #include <unistd.h>
68 int
69 main(int argc, char *argv[])
71     double complex z, c, f;
73     if (argc != 3) {
74         fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]);
75         exit(EXIT_FAILURE);
76     }
78     z = atof(argv[1]) + atof(argv[2]) * I;
80     c = cacosh(z);
81     printf("cacosh() = %6.3f %6.3f*i\en", creal(c), cimag(c));
83     f = 2 * clog(csqrt((z + 1)/2) + csqrt((z \- 1)/2));
84     printf("formula  = %6.3f %6.3f*i\en", creal(f), cimag(f));
86     exit(EXIT_SUCCESS);
88 .EE
89 .\" SRC END
90 .SH SEE ALSO
91 .BR acosh (3),
92 .BR cabs (3),
93 .BR ccosh (3),
94 .BR cimag (3),
95 .BR complex (7)