]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/cacos.3
acos.3, acosh.3, asin.3, asinh.3, atan.3, atan2.3, atanh.3, cabs.3, cacos.3, cacosh...
[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@gamil.com>
3 .\"
4 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
5 .\" Distributed under GPL
6 .\" %%%LICENSE_END
7 .\"
8 .TH CACOS 3 2015-03-02 "" "Linux Programmer's Manual"
9 .SH NAME
10 cacos, cacosf, cacosl \- complex arc cosine
11 .SH SYNOPSIS
12 .B #include <complex.h>
13 .sp
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 .sp
20 Link with \fI\-lm\fP.
21 .SH DESCRIPTION
22 The
23 .BR cacos ()
24 function calculates the complex arc cosine of
25 .IR z .
26 If \fIy\ =\ cacos(z)\fP, then \fIz\ =\ ccos(y)\fP.
27 The real part of
28 .I y
29 is chosen in the interval [0,pi].
30 .LP
31 One has:
32 .nf
33
34 cacos(z) = \-i * clog(z + i * csqrt(1 \- z * z))
35 .fi
36 .SH VERSIONS
37 These functions first appeared in glibc in version 2.1.
38 .SH ATTRIBUTES
39 For an explanation of the terms used in this section, see
40 .BR attributes (7).
41 .TS
42 allbox;
43 lbw28 lb lb
44 l l l.
45 Interface Attribute Value
46 T{
47 .BR cacos (),
48 .BR cacosf (),
49 .BR cacosl ()
50 T} Thread safety MT-Safe
51 .TE
52 .SH CONFORMING TO
53 C99, POSIX.1-2001, POSIX.1-2008.
54 .SH EXAMPLE
55 .nf
56 /* Link with "\-lm" */
57
58 #include <complex.h>
59 #include <stdlib.h>
60 #include <unistd.h>
61 #include <stdio.h>
62
63 int
64 main(int argc, char *argv[])
65 {
66 double complex z, c, f;
67 double complex i = I;
68
69 if (argc != 3) {
70 fprintf(stderr, "Usage: %s <real> <imag>\\n", argv[0]);
71 exit(EXIT_FAILURE);
72 }
73
74 z = atof(argv[1]) + atof(argv[2]) * I;
75
76 c = cacos(z);
77
78 printf("cacos() = %6.3f %6.3f*i\\n", creal(c), cimag(c));
79
80 f = \-i * clog(z + i * csqrt(1 \- z * z));
81
82 printf("formula = %6.3f %6.3f*i\\n", creal(f), cimag(f));
83
84 exit(EXIT_SUCCESS);
85 }
86 .fi
87 .SH SEE ALSO
88 .BR ccos (3),
89 .BR clog (3),
90 .BR complex (7)