]>
Commit | Line | Data |
---|---|---|
4cca6b86 UD |
1 | /* Prototype declarations for complex math functions; |
2 | helper file for <complex.h>. | |
d4697bc9 | 3 | Copyright (C) 1997-2014 Free Software Foundation, Inc. |
4cca6b86 UD |
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 | |
41bdb6e2 AJ |
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. | |
4cca6b86 UD |
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 | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
4cca6b86 | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
17 | License along with the GNU C Library; if not, see |
18 | <http://www.gnu.org/licenses/>. */ | |
4cca6b86 | 19 | |
76b87c03 | 20 | /* NOTE: Because of the special way this file is used by <complex.h>, this |
4cca6b86 UD |
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 | |
5107cf1d | 44 | #error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead." |
4cca6b86 UD |
45 | #endif |
46 | ||
1792d4db | 47 | #define _Mdouble_complex_ _Mdouble_ _Complex |
4cca6b86 UD |
48 | |
49 | ||
50 | /* Trigonometric functions. */ | |
51 | ||
52 | /* Arc cosine of Z. */ | |
53 | __MATHCALL (cacos, (_Mdouble_complex_ __z)); | |
54 | /* Arc sine of Z. */ | |
55 | __MATHCALL (casin, (_Mdouble_complex_ __z)); | |
56 | /* Arc tangent of Z. */ | |
57 | __MATHCALL (catan, (_Mdouble_complex_ __z)); | |
58 | ||
59 | /* Cosine of Z. */ | |
60 | __MATHCALL (ccos, (_Mdouble_complex_ __z)); | |
61 | /* Sine of Z. */ | |
62 | __MATHCALL (csin, (_Mdouble_complex_ __z)); | |
63 | /* Tangent of Z. */ | |
64 | __MATHCALL (ctan, (_Mdouble_complex_ __z)); | |
65 | ||
66 | ||
67 | /* Hyperbolic functions. */ | |
68 | ||
69 | /* Hyperbolic arc cosine of Z. */ | |
70 | __MATHCALL (cacosh, (_Mdouble_complex_ __z)); | |
71 | /* Hyperbolic arc sine of Z. */ | |
72 | __MATHCALL (casinh, (_Mdouble_complex_ __z)); | |
73 | /* Hyperbolic arc tangent of Z. */ | |
74 | __MATHCALL (catanh, (_Mdouble_complex_ __z)); | |
75 | ||
76 | /* Hyperbolic cosine of Z. */ | |
77 | __MATHCALL (ccosh, (_Mdouble_complex_ __z)); | |
78 | /* Hyperbolic sine of Z. */ | |
79 | __MATHCALL (csinh, (_Mdouble_complex_ __z)); | |
80 | /* Hyperbolic tangent of Z. */ | |
81 | __MATHCALL (ctanh, (_Mdouble_complex_ __z)); | |
82 | ||
83 | ||
84 | /* Exponential and logarithmic functions. */ | |
85 | ||
86 | /* Exponential function of Z. */ | |
87 | __MATHCALL (cexp, (_Mdouble_complex_ __z)); | |
88 | ||
89 | /* Natural logarithm of Z. */ | |
90 | __MATHCALL (clog, (_Mdouble_complex_ __z)); | |
91 | ||
dfd2257a UD |
92 | #ifdef __USE_GNU |
93 | /* The base 10 logarithm is not defined by the standard but to implement | |
94 | the standard C++ library it is handy. */ | |
95 | __MATHCALL (clog10, (_Mdouble_complex_ __z)); | |
96 | #endif | |
4cca6b86 UD |
97 | |
98 | /* Power functions. */ | |
99 | ||
100 | /* Return X to the Y power. */ | |
101 | __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); | |
102 | ||
103 | /* Return the square root of Z. */ | |
104 | __MATHCALL (csqrt, (_Mdouble_complex_ __z)); | |
105 | ||
106 | ||
b4012b75 | 107 | /* Absolute value, conjugates, and projection. */ |
4cca6b86 UD |
108 | |
109 | /* Absolute value of Z. */ | |
3e5f5557 | 110 | __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); |
4cca6b86 UD |
111 | |
112 | /* Argument value of Z. */ | |
3e5f5557 | 113 | __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); |
4cca6b86 UD |
114 | |
115 | /* Complex conjugate of Z. */ | |
116 | __MATHCALL (conj, (_Mdouble_complex_ __z)); | |
117 | ||
118 | /* Projection of Z onto the Riemann sphere. */ | |
119 | __MATHCALL (cproj, (_Mdouble_complex_ __z)); | |
120 | ||
121 | ||
122 | /* Decomposing complex values. */ | |
123 | ||
124 | /* Imaginary part of Z. */ | |
3e5f5557 | 125 | __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); |
4cca6b86 UD |
126 | |
127 | /* Real part of Z. */ | |
3e5f5557 | 128 | __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); |
4cca6b86 UD |
129 | |
130 | ||
131 | /* Now some optimized versions. GCC has handy notations for these | |
ec28fc7c UD |
132 | functions. Recent GCC handles these as builtin functions so does |
133 | not need inlines. */ | |
de1c3ebb UD |
134 | #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ \ |
135 | && defined __extern_inline | |
4cca6b86 UD |
136 | |
137 | /* Imaginary part of Z. */ | |
b037a293 | 138 | __extern_inline _Mdouble_ |
8ca91b36 | 139 | __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW |
4cca6b86 UD |
140 | { |
141 | return __imag__ __z; | |
142 | } | |
143 | ||
144 | /* Real part of Z. */ | |
b037a293 | 145 | __extern_inline _Mdouble_ |
8ca91b36 | 146 | __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW |
4cca6b86 UD |
147 | { |
148 | return __real__ __z; | |
149 | } | |
150 | ||
151 | /* Complex conjugate of Z. */ | |
b037a293 | 152 | __extern_inline _Mdouble_complex_ |
8ca91b36 | 153 | __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW |
4cca6b86 | 154 | { |
5985c772 | 155 | return __extension__ ~__z; |
4cca6b86 UD |
156 | } |
157 | ||
158 | #endif |