OSDN Git Service

(split) LDP: Update original to LDP v3.63
[linuxjm/LDP_man-pages.git] / original / man3 / cacosh.3
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 CACOSH 3 2011-09-15 "" "Linux Programmer's Manual"
9 .SH NAME
10 cacosh, cacoshf, cacoshl \- complex arc hyperbolic cosine
11 .SH SYNOPSIS
12 .B #include <complex.h>
13 .sp
14 .BI "double complex cacosh(double complex " z );
15 .br
16 .BI "float complex cacoshf(float complex " z );
17 .br
18 .BI "long double complex cacoshl(long double complex " z );
19 .sp
20 Link with \fI\-lm\fP.
21 .SH DESCRIPTION
22 The
23 .BR cacosh ()
24 function calculates the complex arc hyperbolic cosine of
25 .IR z .
26 If \fIy\ =\ cacosh(z)\fP, then \fIz\ =\ ccosh(y)\fP.
27 The imaginary part of
28 .I y
29 is chosen in the interval [\-pi,pi].
30 The real part of
31 .I y
32 is chosen nonnegative.
33 .LP
34 One has:
35 .nf
36
37     cacosh(z) = 2 * clog(csqrt((z + 1) / 2) + csqrt((z \- 1) / 2))
38 .fi
39 .SH VERSIONS
40 These functions first appeared in glibc in version 2.1.
41 .SH CONFORMING TO
42 C99.
43 .SH EXAMPLE
44 .nf
45 /* Link with "\-lm" */
46
47 #include <complex.h>
48 #include <stdlib.h>
49 #include <unistd.h>
50 #include <stdio.h>
51
52 int
53 main(int argc, char *argv[])
54 {
55     double complex z, c, f;
56
57     if (argc != 3) {
58         fprintf(stderr, "Usage: %s <real> <imag>\\n", argv[0]);
59         exit(EXIT_FAILURE);
60     }
61
62     z = atof(argv[1]) + atof(argv[2]) * I;
63
64     c = cacosh(z);
65     printf("cacosh() = %6.3f %6.3f*i\\n", creal(c), cimag(c));
66
67     f = 2 * clog(csqrt((z + 1)/2) + csqrt((z \- 1)/2));
68     printf("formula  = %6.3f %6.3f*i\\n", creal(f2), cimag(f2));
69
70     exit(EXIT_SUCCESS);
71 }
72 .fi
73 .SH SEE ALSO
74 .BR acosh (3),
75 .BR cabs (3),
76 .BR ccosh (3),
77 .BR cimag (3),
78 .BR complex (7)