OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / 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 2011-09-15 "" "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 CONFORMING TO
39 C99.
40 .SH EXAMPLE
41 .nf
42 /* Link with "\-lm" */
43
44 #include <complex.h>
45 #include <stdlib.h>
46 #include <unistd.h>
47 #include <stdio.h>
48
49 int
50 main(int argc, char *argv[])
51 {
52     double complex z, c, f;
53     double complex i = I;
54
55     if (argc != 3) {
56         fprintf(stderr, "Usage: %s <real> <imag>\\n", argv[0]);
57         exit(EXIT_FAILURE);
58     }
59
60     z = atof(argv[1]) + atof(argv[2]) * I;
61
62     c = cacos(z);
63
64     printf("cacos() = %6.3f %6.3f*i\\n", creal(c), cimag(c));
65
66     f = \-i * clog(z + i * csqrt(1 \- z * z));
67
68     printf("formula = %6.3f %6.3f*i\\n", creal(f), cimag(f));
69
70     exit(EXIT_SUCCESS);
71 }
72 .fi
73 .SH SEE ALSO
74 .BR ccos (3),
75 .BR clog (3),
76 .BR complex (7)
77 .SH COLOPHON
78 This page is part of release 3.79 of the Linux
79 .I man-pages
80 project.
81 A description of the project,
82 information about reporting bugs,
83 and the latest version of this page,
84 can be found at
85 \%http://www.kernel.org/doc/man\-pages/.