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