1 /* Prototype declarations for complex math functions;
2    helper file for <complex.h>.
3    Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
4    This file is part of the GNU C Library.
5 
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10 
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15 
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <http://www.gnu.org/licenses/>.  */
19 
20 /* NOTE: Because of the special way this file is used by <complex.h>, this
21    file must NOT be protected from multiple inclusion as header files
22    usually are.
23 
24    This file provides prototype declarations for the math functions.
25    Most functions are declared using the macro:
26 
27    __MATHCALL (NAME, (ARGS...));
28 
29    This means there is a function `NAME' returning `double' and a function
30    `NAMEf' returning `float'.  Each place `_Mdouble_' appears in the
31    prototype, that is actually `double' in the prototype for `NAME' and
32    `float' in the prototype for `NAMEf'.  Reentrant variant functions are
33    called `NAME_r' and `NAMEf_r'.
34 
35    Functions returning other types like `int' are declared using the macro:
36 
37    __MATHDECL (TYPE, NAME, (ARGS...));
38 
39    This is just like __MATHCALL but for a function returning `TYPE'
40    instead of `_Mdouble_'.  In all of these cases, there is still
41    both a `NAME' and a `NAMEf' that takes `float' arguments.  */
42 
43 #ifndef _COMPLEX_H
44 #error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
45 #endif
46 
47 #define _Mdouble_complex_ _Mdouble_ _Complex
48 
49 
50 /* Trigonometric functions.  */
51 
52 /* Arc cosine of Z.  */
53 __MATHCALL (cacos, (_Mdouble_complex_ __z));
54 libm_hidden_proto(cacos)
55 /* Arc sine of Z.  */
56 __MATHCALL (casin, (_Mdouble_complex_ __z));
57 libm_hidden_proto(casin)
58 /* Arc tangent of Z.  */
59 __MATHCALL (catan, (_Mdouble_complex_ __z));
60 libm_hidden_proto(catan)
61 
62 /* Cosine of Z.  */
63 __MATHCALL (ccos, (_Mdouble_complex_ __z));
64 libm_hidden_proto(ccos)
65 /* Sine of Z.  */
66 __MATHCALL (csin, (_Mdouble_complex_ __z));
67 libm_hidden_proto(csin)
68 /* Tangent of Z.  */
69 __MATHCALL (ctan, (_Mdouble_complex_ __z));
70 libm_hidden_proto(ctan)
71 
72 
73 /* Hyperbolic functions.  */
74 
75 /* Hyperbolic arc cosine of Z.  */
76 __MATHCALL (cacosh, (_Mdouble_complex_ __z));
77 libm_hidden_proto(cacosh)
78 /* Hyperbolic arc sine of Z.  */
79 __MATHCALL (casinh, (_Mdouble_complex_ __z));
80 libm_hidden_proto(casinh)
81 /* Hyperbolic arc tangent of Z.  */
82 __MATHCALL (catanh, (_Mdouble_complex_ __z));
83 libm_hidden_proto(catanh)
84 
85 /* Hyperbolic cosine of Z.  */
86 __MATHCALL (ccosh, (_Mdouble_complex_ __z));
87 libm_hidden_proto(ccosh)
88 /* Hyperbolic sine of Z.  */
89 __MATHCALL (csinh, (_Mdouble_complex_ __z));
90 libm_hidden_proto(ccosh)
91 /* Hyperbolic tangent of Z.  */
92 __MATHCALL (ctanh, (_Mdouble_complex_ __z));
93 libm_hidden_proto(ctanh)
94 
95 
96 /* Exponential and logarithmic functions.  */
97 
98 /* Exponential function of Z.  */
99 __MATHCALL (cexp, (_Mdouble_complex_ __z));
100 libm_hidden_proto(cexp)
101 
102 /* Natural logarithm of Z.  */
103 __MATHCALL (clog, (_Mdouble_complex_ __z));
104 libm_hidden_proto(clog)
105 
106 #ifdef __USE_GNU
107 /* The base 10 logarithm is not defined by the standard but to implement
108    the standard C++ library it is handy.  */
109 __MATHCALL (clog10, (_Mdouble_complex_ __z));
110 libm_hidden_proto(clog10)
111 #endif
112 
113 /* Power functions.  */
114 
115 /* Return X to the Y power.  */
116 __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
117 libm_hidden_proto(cpow)
118 
119 /* Return the square root of Z.  */
120 __MATHCALL (csqrt, (_Mdouble_complex_ __z));
121 libm_hidden_proto(csqrt)
122 
123 
124 /* Absolute value, conjugates, and projection.  */
125 
126 /* Absolute value of Z.  */
127 __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
128 libm_hidden_proto(cabs)
129 
130 /* Argument value of Z.  */
131 __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
132 libm_hidden_proto(carg)
133 
134 /* Complex conjugate of Z.  */
135 __MATHCALL (conj, (_Mdouble_complex_ __z));
136 libm_hidden_proto(conj)
137 
138 /* Projection of Z onto the Riemann sphere.  */
139 __MATHCALL (cproj, (_Mdouble_complex_ __z));
140 libm_hidden_proto(cproj)
141 
142 
143 /* Decomposing complex values.  */
144 
145 /* Imaginary part of Z.  */
146 __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
147 libm_hidden_proto(cimag)
148 
149 /* Real part of Z.  */
150 __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
libm_hidden_proto(creal)151 libm_hidden_proto(creal)
152 
153 
154 /* Now some optimized versions.  GCC has handy notations for these
155    functions.  Recent GCC handles these as builtin functions so does
156    not need inlines.  */
157 #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__
158 
159 /* Imaginary part of Z.  */
160 __extern_inline _Mdouble_
161 __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
162 {
163   return __imag__ __z;
164 }
165 
166 /* Real part of Z.  */
167 __extern_inline _Mdouble_
__MATH_PRECNAME(creal)168 __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
169 {
170   return __real__ __z;
171 }
172 
173 /* Complex conjugate of Z.  */
174 __extern_inline _Mdouble_complex_
__MATH_PRECNAME(conj)175 __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
176 {
177   return __extension__ ~__z;
178 }
179 
180 #endif
181