1cacosh(3) Library Functions Manual cacosh(3)
2
3
4
6 cacosh, cacoshf, cacoshl - complex arc hyperbolic cosine
7
9 Math library (libm, -lm)
10
12 #include <complex.h>
13
14 double complex cacosh(double complex z);
15 float complex cacoshf(float complex z);
16 long double complex cacoshl(long double complex z);
17
19 These functions calculate the complex arc hyperbolic cosine of z. If
20 y = cacosh(z), then z = ccosh(y). The imaginary part of y is chosen in
21 the interval [-pi,pi]. The real part of y is chosen nonnegative.
22
23 One has:
24
25 cacosh(z) = 2 * clog(csqrt((z + 1) / 2) + csqrt((z - 1) / 2))
26
28 For an explanation of the terms used in this section, see at‐
29 tributes(7).
30
31 ┌────────────────────────────────────────────┬───────────────┬─────────┐
32 │Interface │ Attribute │ Value │
33 ├────────────────────────────────────────────┼───────────────┼─────────┤
34 │cacosh(), cacoshf(), cacoshl() │ Thread safety │ MT-Safe │
35 └────────────────────────────────────────────┴───────────────┴─────────┘
36
38 C11, POSIX.1-2008.
39
41 C99, POSIX.1-2001. glibc 2.1.
42
44 /* Link with "-lm" */
45
46 #include <complex.h>
47 #include <stdio.h>
48 #include <stdlib.h>
49 #include <unistd.h>
50
51 int
52 main(int argc, char *argv[])
53 {
54 double complex z, c, f;
55
56 if (argc != 3) {
57 fprintf(stderr, "Usage: %s <real> <imag>\n", argv[0]);
58 exit(EXIT_FAILURE);
59 }
60
61 z = atof(argv[1]) + atof(argv[2]) * I;
62
63 c = cacosh(z);
64 printf("cacosh() = %6.3f %6.3f*i\n", creal(c), cimag(c));
65
66 f = 2 * clog(csqrt((z + 1)/2) + csqrt((z - 1)/2));
67 printf("formula = %6.3f %6.3f*i\n", creal(f), cimag(f));
68
69 exit(EXIT_SUCCESS);
70 }
71
73 acosh(3), cabs(3), ccosh(3), cimag(3), complex(7)
74
75
76
77Linux man-pages 6.04 2023-03-30 cacosh(3)