]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de) |
cd2c21a0 | 2 | .\" and Copyright (C) 2011 Michael Kerrisk <mtk.manpages@gmail.com> |
2297bf0e | 3 | .\" |
95fb8859 | 4 | .\" SPDX-License-Identifier: GPL-1.0-or-later |
fea681da | 5 | .\" |
1ae6b2c7 | 6 | .TH CACOS 3 2021-03-22 GNU "Linux Programmer's Manual" |
fea681da MK |
7 | .SH NAME |
8 | cacos, cacosf, cacosl \- complex arc cosine | |
2af19291 AC |
9 | .SH LIBRARY |
10 | Math library | |
8fc3b2cf | 11 | .RI ( libm ", " \-lm ) |
fea681da | 12 | .SH SYNOPSIS |
c7db92b9 | 13 | .nf |
fea681da | 14 | .B #include <complex.h> |
68e4db0a | 15 | .PP |
c13182ef | 16 | .BI "double complex cacos(double complex " z ); |
c13182ef | 17 | .BI "float complex cacosf(float complex " z ); |
c13182ef | 18 | .BI "long double complex cacosl(long double complex " z ); |
c7db92b9 | 19 | .fi |
fea681da | 20 | .SH DESCRIPTION |
5600f73a | 21 | These functions calculate the complex arc cosine of |
daac0b39 MK |
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]. | |
dd3568a1 | 27 | .PP |
daac0b39 | 28 | One has: |
207050fa | 29 | .PP |
daac0b39 | 30 | .nf |
4c3fa19d | 31 | cacos(z) = \-i * clog(z + i * csqrt(1 \- z * z)) |
daac0b39 | 32 | .fi |
f0d7ce1d MK |
33 | .SH VERSIONS |
34 | These functions first appeared in glibc in version 2.1. | |
7934e762 MS |
35 | .SH ATTRIBUTES |
36 | For an explanation of the terms used in this section, see | |
37 | .BR attributes (7). | |
c466875e MK |
38 | .ad l |
39 | .nh | |
7934e762 MS |
40 | .TS |
41 | allbox; | |
c466875e | 42 | lbx lb lb |
7934e762 MS |
43 | l l l. |
44 | Interface Attribute Value | |
45 | T{ | |
46 | .BR cacos (), | |
47 | .BR cacosf (), | |
48 | .BR cacosl () | |
49 | T} Thread safety MT-Safe | |
50 | .TE | |
c466875e MK |
51 | .hy |
52 | .ad | |
53 | .sp 1 | |
47297adb | 54 | .SH CONFORMING TO |
9a74e018 | 55 | C99, POSIX.1-2001, POSIX.1-2008. |
a14af333 | 56 | .SH EXAMPLES |
207050fa | 57 | .EX |
8fa05874 MK |
58 | /* Link with "\-lm" */ |
59 | ||
60 | #include <complex.h> | |
61 | #include <stdlib.h> | |
62 | #include <unistd.h> | |
63 | #include <stdio.h> | |
64 | ||
65 | int | |
66 | main(int argc, char *argv[]) | |
67 | { | |
68 | double complex z, c, f; | |
69 | double complex i = I; | |
70 | ||
71 | if (argc != 3) { | |
d1a71985 | 72 | fprintf(stderr, "Usage: %s <real> <imag>\en", argv[0]); |
8fa05874 MK |
73 | exit(EXIT_FAILURE); |
74 | } | |
75 | ||
76 | z = atof(argv[1]) + atof(argv[2]) * I; | |
77 | ||
78 | c = cacos(z); | |
79 | ||
d1a71985 | 80 | printf("cacos() = %6.3f %6.3f*i\en", creal(c), cimag(c)); |
8fa05874 MK |
81 | |
82 | f = \-i * clog(z + i * csqrt(1 \- z * z)); | |
83 | ||
d1a71985 | 84 | printf("formula = %6.3f %6.3f*i\en", creal(f), cimag(f)); |
8fa05874 MK |
85 | |
86 | exit(EXIT_SUCCESS); | |
87 | } | |
207050fa | 88 | .EE |
47297adb | 89 | .SH SEE ALSO |
fea681da MK |
90 | .BR ccos (3), |
91 | .BR clog (3), | |
a8bda636 | 92 | .BR complex (7) |