]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/cacos.3
getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd...
[thirdparty/man-pages.git] / man3 / cacos.3
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 2019-03-06 "" "Linux Programmer's Manual"
9 .SH NAME
10 cacos, cacosf, cacosl \- complex arc cosine
11 .SH SYNOPSIS
12 .B #include <complex.h>
13 .PP
14 .BI "double complex cacos(double complex " z );
15 .br
16 .BI "float complex cacosf(float complex " z );
17 .br
18 .BI "long double complex cacosl(long double complex " z );
19 .PP
20 Link with \fI\-lm\fP.
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 .TS
40 allbox;
41 lbw28 lb lb
42 l l l.
43 Interface Attribute Value
44 T{
45 .BR cacos (),
46 .BR cacosf (),
47 .BR cacosl ()
48 T} Thread safety MT-Safe
49 .TE
50 .SH CONFORMING TO
51 C99, POSIX.1-2001, POSIX.1-2008.
52 .SH EXAMPLE
53 .EX
54 /* Link with "\-lm" */
55
56 #include <complex.h>
57 #include <stdlib.h>
58 #include <unistd.h>
59 #include <stdio.h>
60
61 int
62 main(int argc, char *argv[])
63 {
64 double complex z, c, f;
65 double complex i = I;
66
67 if (argc != 3) {
68 fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]);
69 exit(EXIT_FAILURE);
70 }
71
72 z = atof(argv[1]) + atof(argv[2]) * I;
73
74 c = cacos(z);
75
76 printf("cacos() = %6.3f %6.3f*i\en", creal(c), cimag(c));
77
78 f = \-i * clog(z + i * csqrt(1 \- z * z));
79
80 printf("formula = %6.3f %6.3f*i\en", creal(f), cimag(f));
81
82 exit(EXIT_SUCCESS);
83 }
84 .EE
85 .SH SEE ALSO
86 .BR ccos (3),
87 .BR clog (3),
88 .BR complex (7)