close_range.2: Glibc 2.34 has added a close_range() wrapper
[man-pages.git] / man3 / cacosh.3
blobdc131f3e09da4783697b33ccf0a66fe0f98e0e60
1 .\" Copyright 2002 Walter Harms(walter.harms@informatik.uni-oldenburg.de)
2 .\" and Copyright (C) 2011 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
5 .\" Distributed under GPL
6 .\" %%%LICENSE_END
7 .\"
8 .TH CACOSH 3 2021-03-22 "" "Linux Programmer's Manual"
9 .SH NAME
10 cacosh, cacoshf, cacoshl \- complex arc hyperbolic cosine
11 .SH SYNOPSIS
12 .nf
13 .B #include <complex.h>
14 .PP
15 .BI "double complex cacosh(double complex " z );
16 .BI "float complex cacoshf(float complex " z );
17 .BI "long double complex cacoshl(long double complex " z );
18 .PP
19 Link with \fI\-lm\fP.
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.
31 .PP
32 One has:
33 .PP
34 .nf
35     cacosh(z) = 2 * clog(csqrt((z + 1) / 2) + csqrt((z \- 1) / 2))
36 .fi
37 .SH VERSIONS
38 These functions first appeared in glibc in version 2.1.
39 .SH ATTRIBUTES
40 For an explanation of the terms used in this section, see
41 .BR attributes (7).
42 .ad l
43 .nh
44 .TS
45 allbox;
46 lbx lb lb
47 l l l.
48 Interface       Attribute       Value
50 .BR cacosh (),
51 .BR cacoshf (),
52 .BR cacoshl ()
53 T}      Thread safety   MT-Safe
54 .TE
55 .hy
56 .ad
57 .sp 1
58 .SH CONFORMING TO
59 C99, POSIX.1-2001, POSIX.1-2008.
60 .SH EXAMPLES
61 .EX
62 /* Link with "\-lm" */
64 #include <complex.h>
65 #include <stdlib.h>
66 #include <unistd.h>
67 #include <stdio.h>
69 int
70 main(int argc, char *argv[])
72     double complex z, c, f;
74     if (argc != 3) {
75         fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]);
76         exit(EXIT_FAILURE);
77     }
79     z = atof(argv[1]) + atof(argv[2]) * I;
81     c = cacosh(z);
82     printf("cacosh() = %6.3f %6.3f*i\en", creal(c), cimag(c));
84     f = 2 * clog(csqrt((z + 1)/2) + csqrt((z \- 1)/2));
85     printf("formula  = %6.3f %6.3f*i\en", creal(f2), cimag(f2));
87     exit(EXIT_SUCCESS);
89 .EE
90 .SH SEE ALSO
91 .BR acosh (3),
92 .BR cabs (3),
93 .BR ccosh (3),
94 .BR cimag (3),
95 .BR complex (7)