OSDN Git Service

(split) LDP_man-pages: update original to v3.34.
[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 .\" Distributed under GPL
4 .\"
5 .TH CACOS 3 2011-09-15 "" "Linux Programmer's Manual"
6 .SH NAME
7 cacos, cacosf, cacosl \- complex arc cosine
8 .SH SYNOPSIS
9 .B #include <complex.h>
10 .sp
11 .BI "double complex cacos(double complex " z );
12 .br
13 .BI "float complex cacosf(float complex " z );
14 .br
15 .BI "long double complex cacosl(long double complex " z );
16 .sp
17 Link with \fI\-lm\fP.
18 .SH DESCRIPTION
19 The
20 .BR cacos ()
21 function calculates the complex arc cosine of
22 .IR z .
23 If \fIy\ =\ cacos(z)\fP, then \fIz\ =\ ccos(y)\fP.
24 The real part of
25 .I y
26 is chosen in the interval [0,pi].
27 .LP
28 One has:
29 .nf
30
31     cacos(z) = \-i * clog(z + i * csqrt(1 \- z * z))
32 .fi
33 .SH VERSIONS
34 These functions first appeared in glibc in version 2.1.
35 .SH "CONFORMING TO"
36 C99.
37 .SH EXAMPLE
38 .nf
39 /* Link with "\-lm" */
40
41 #include <complex.h>
42 #include <stdlib.h>
43 #include <unistd.h>
44 #include <stdio.h>
45
46 int
47 main(int argc, char *argv[])
48 {
49     double complex z, c, f;
50     double complex i = I;
51
52     if (argc != 3) {
53         fprintf(stderr, "Usage: %s <real> <imag>\\n", argv[0]);
54         exit(EXIT_FAILURE);
55     }
56
57     z = atof(argv[1]) + atof(argv[2]) * I;
58
59     c = cacos(z);
60
61     printf("cacos() = %6.3f %6.3f*i\\n", creal(c), cimag(c));
62
63     f = \-i * clog(z + i * csqrt(1 \- z * z));
64
65     printf("formula = %6.3f %6.3f*i\\n", creal(f), cimag(f));
66
67     exit(EXIT_SUCCESS);
68 }
69 .fi
70 .SH "SEE ALSO"
71 .BR ccos (3),
72 .BR clog (3),
73 .BR complex (7)