Debian Codegraph @

upstream/debian-unstable/man3/cacosh.3

raw
1 '\" t
2 .\" Copyright 2002, Walter Harms <[email protected]>
3 .\" Copyright 2011, Michael Kerrisk <[email protected]>
4 .\" Copyright, the authors of the Linux man-pages project
5 .\"
6 .\" SPDX-License-Identifier: GPL-1.0-or-later
7 .\"
8 .TH cacosh 3 2026-02-08 "Linux man-pages 6.18"
9 .SH NAME
10 cacosh, cacoshf, cacoshl \- complex arc hyperbolic cosine
11 .SH LIBRARY
12 Math library
13 .RI ( libm ,\~ \-lm )
14 .SH SYNOPSIS
15 .nf
16 .B #include <complex.h>
17 .P
18 .BI "double complex cacosh(double complex " z );
19 .BI "float complex cacoshf(float complex " z );
20 .BI "long double complex cacoshl(long double complex " z );
21 .fi
22 .SH DESCRIPTION
23 These functions calculate the complex arc hyperbolic cosine of
24 .IR z .
25 If
26 .IR "y\ =\ cacosh(z)" ,
27 then
28 .IR "z\ =\ ccosh(y)" .
29 The imaginary part of
30 .I y
31 is chosen in the interval [\-pi,pi].
32 The real part of
33 .I y
34 is chosen nonnegative.
35 .P
36 One has:
37 .P
38 .nf
39 cacosh(z) = 2 * clog(csqrt((z + 1) / 2) + csqrt((z \- 1) / 2))
40 .fi
41 .SH ATTRIBUTES
42 For an explanation of the terms used in this section, see
43 .BR attributes (7).
44 .TS
45 allbox;
46 lbx lb lb
47 l l l.
48 Interface Attribute Value
49 T{
50 .na
51 .nh
52 .BR cacosh (),
53 .BR cacoshf (),
54 .BR cacoshl ()
55 T} Thread safety MT-Safe
56 .TE
57 .SH STANDARDS
58 C11, POSIX.1-2008.
59 .SH HISTORY
60 C99, POSIX.1-2001.
61 glibc 2.1.
62 .SH EXAMPLES
63 .\" SRC BEGIN (cacosh.c)
64 .EX
65 /* Link with "\-lm" */
66 \&
67 #include <complex.h>
68 #include <stdio.h>
69 #include <stdlib.h>
70 #include <unistd.h>
71 \&
72 int
73 main(int argc, char *argv[])
74 {
75 double complex z, c, f;
76 \&
77 if (argc != 3) {
78 fprintf(stderr, "Usage: %s <real> <imag>\[rs]n", argv[0]);
79 exit(EXIT_FAILURE);
80 }
81 \&
82 z = atof(argv[1]) + atof(argv[2]) * I;
83 \&
84 c = cacosh(z);
85 printf("cacosh() = %6.3f %6.3f*i\[rs]n", creal(c), cimag(c));
86 \&
87 f = 2 * clog(csqrt((z + 1)/2) + csqrt((z \- 1)/2));
88 printf("formula = %6.3f %6.3f*i\[rs]n", creal(f), cimag(f));
89 \&
90 exit(EXIT_SUCCESS);
91 }
92 .EE
93 .\" SRC END
94 .SH SEE ALSO
95 .BR acosh (3),
96 .BR cabs (3),
97 .BR ccosh (3),
98 .BR cimag (3),
99 .BR complex (7)