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