memfd_secret.2: SEE ALSO: add memfd_create(2)
[man-pages.git] / man3 / cacos.3
blob5ba4fcdd3b55ad6ab22c22c8ffa68f77408b17f2
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 CACOS 3 2021-03-22 "" "Linux Programmer's Manual"
9 .SH NAME
10 cacos, cacosf, cacosl \- complex arc cosine
11 .SH SYNOPSIS
12 .nf
13 .B #include <complex.h>
14 .PP
15 .BI "double complex cacos(double complex " z );
16 .BI "float complex cacosf(float complex " z );
17 .BI "long double complex cacosl(long double complex " z );
18 .PP
19 Link with \fI\-lm\fP.
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 .PP
29 One has:
30 .PP
31 .nf
32     cacos(z) = \-i * clog(z + i * csqrt(1 \- z * z))
33 .fi
34 .SH VERSIONS
35 These functions first appeared in glibc in version 2.1.
36 .SH ATTRIBUTES
37 For an explanation of the terms used in this section, see
38 .BR attributes (7).
39 .ad l
40 .nh
41 .TS
42 allbox;
43 lbx lb lb
44 l l l.
45 Interface       Attribute       Value
47 .BR cacos (),
48 .BR cacosf (),
49 .BR cacosl ()
50 T}      Thread safety   MT-Safe
51 .TE
52 .hy
53 .ad
54 .sp 1
55 .SH CONFORMING TO
56 C99, POSIX.1-2001, POSIX.1-2008.
57 .SH EXAMPLES
58 .EX
59 /* Link with "\-lm" */
61 #include <complex.h>
62 #include <stdlib.h>
63 #include <unistd.h>
64 #include <stdio.h>
66 int
67 main(int argc, char *argv[])
69     double complex z, c, f;
70     double complex i = I;
72     if (argc != 3) {
73         fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]);
74         exit(EXIT_FAILURE);
75     }
77     z = atof(argv[1]) + atof(argv[2]) * I;
79     c = cacos(z);
81     printf("cacos() = %6.3f %6.3f*i\en", creal(c), cimag(c));
83     f = \-i * clog(z + i * csqrt(1 \- z * z));
85     printf("formula = %6.3f %6.3f*i\en", creal(f), cimag(f));
87     exit(EXIT_SUCCESS);
89 .EE
90 .SH SEE ALSO
91 .BR ccos (3),
92 .BR clog (3),
93 .BR complex (7)