Debian Codegraph @

upstream/debian-unstable/man3/cacos.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 cacos 3 2026-02-08 "Linux man-pages 6.18"
9 .SH NAME
10 cacos, cacosf, cacosl \- complex arc 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 cacos(double complex " z );
19 .BI "float complex cacosf(float complex " z );
20 .BI "long double complex cacosl(long double complex " z );
21 .fi
22 .SH DESCRIPTION
23 These functions calculate the complex arc cosine of
24 .IR z .
25 If
26 .IR "y\ =\ cacos(z)" ,
27 then
28 .IR "z\ =\ ccos(y)" .
29 The real part of
30 .I y
31 is chosen in the interval [0,pi].
32 .P
33 One has:
34 .P
35 .nf
36 cacos(z) = \-i * clog(z + i * csqrt(1 \- z * z))
37 .fi
38 .SH ATTRIBUTES
39 For an explanation of the terms used in this section, see
40 .BR attributes (7).
41 .TS
42 allbox;
43 lbx lb lb
44 l l l.
45 Interface Attribute Value
46 T{
47 .na
48 .nh
49 .BR cacos (),
50 .BR cacosf (),
51 .BR cacosl ()
52 T} Thread safety MT-Safe
53 .TE
54 .SH STANDARDS
55 C11, POSIX.1-2008.
56 .SH HISTORY
57 glibc 2.1.
58 C99, POSIX.1-2001.
59 .SH EXAMPLES
60 .\" SRC BEGIN (cacos.c)
61 .EX
62 /* Link with "\-lm" */
63 \&
64 #include <complex.h>
65 #include <stdio.h>
66 #include <stdlib.h>
67 #include <unistd.h>
68 \&
69 int
70 main(int argc, char *argv[])
71 {
72 double complex z, c, f;
73 double complex i = I;
74 \&
75 if (argc != 3) {
76 fprintf(stderr, "Usage: %s <real> <imag>\[rs]n", argv[0]);
77 exit(EXIT_FAILURE);
78 }
79 \&
80 z = atof(argv[1]) + atof(argv[2]) * I;
81 \&
82 c = cacos(z);
83 \&
84 printf("cacos() = %6.3f %6.3f*i\[rs]n", creal(c), cimag(c));
85 \&
86 f = \-i * clog(z + i * csqrt(1 \- z * z));
87 \&
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 ccos (3),
96 .BR clog (3),
97 .BR complex (7)