Debian Codegraph @

upstream/debian-trixie/man3/cacos.3

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