]>
Commit | Line | Data |
---|---|---|
f7eac6eb | 1 | /* Prototype declarations for math functions; helper file for <math.h>. |
19361cb7 | 2 | Copyright (C) 1996, 1997 Free Software Foundation, Inc. |
2c6fe0bd | 3 | This file is part of the GNU C Library. |
f7eac6eb | 4 | |
2c6fe0bd UD |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public License as | |
7 | published by the Free Software Foundation; either version 2 of the | |
8 | License, or (at your option) any later version. | |
f7eac6eb | 9 | |
2c6fe0bd UD |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Library General Public License for more details. | |
f7eac6eb | 14 | |
2c6fe0bd UD |
15 | You should have received a copy of the GNU Library General Public |
16 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
17 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
f7eac6eb RM |
19 | |
20 | /* NOTE: Because of the special way this file is used by <math.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,[_r], (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,[_r], (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 _MATH_H | |
5107cf1d | 44 | #error "Never include <bits/mathcalls.h> directly; include <math.h> instead." |
f7eac6eb RM |
45 | #endif |
46 | ||
47 | ||
48 | /* Trigonometric functions. */ | |
49 | ||
50 | /* Arc cosine of X. */ | |
51 | __MATHCALL (acos,, (_Mdouble_ __x)); | |
52 | /* Arc sine of X. */ | |
53 | __MATHCALL (asin,, (_Mdouble_ __x)); | |
54 | /* Arc tangent of X. */ | |
55 | __MATHCALL (atan,, (_Mdouble_ __x)); | |
56 | /* Arc tangent of Y/X. */ | |
57 | __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); | |
58 | ||
59 | /* Cosine of X. */ | |
60 | __MATHCALL (cos,, (_Mdouble_ __x)); | |
61 | /* Sine of X. */ | |
62 | __MATHCALL (sin,, (_Mdouble_ __x)); | |
63 | /* Tangent of X. */ | |
64 | __MATHCALL (tan,, (_Mdouble_ __x)); | |
65 | ||
7799b7b3 UD |
66 | #ifdef __USE_GNU |
67 | /* Cosine and sine of X. */ | |
68 | __MATHDECL (void, sincos,, | |
69 | (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); | |
70 | #endif | |
f7eac6eb RM |
71 | |
72 | /* Hyperbolic functions. */ | |
73 | ||
74 | /* Hyperbolic cosine of X. */ | |
75 | __MATHCALL (cosh,, (_Mdouble_ __x)); | |
76 | /* Hyperbolic sine of X. */ | |
77 | __MATHCALL (sinh,, (_Mdouble_ __x)); | |
78 | /* Hyperbolic tangent of X. */ | |
79 | __MATHCALL (tanh,, (_Mdouble_ __x)); | |
80 | ||
377a515b | 81 | #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X |
f7eac6eb RM |
82 | /* Hyperbolic arc cosine of X. */ |
83 | __MATHCALL (acosh,, (_Mdouble_ __x)); | |
84 | /* Hyperbolic arc sine of X. */ | |
85 | __MATHCALL (asinh,, (_Mdouble_ __x)); | |
86 | /* Hyperbolic arc tangent of X. */ | |
87 | __MATHCALL (atanh,, (_Mdouble_ __x)); | |
88 | #endif | |
89 | ||
90 | /* Exponential and logarithmic functions. */ | |
91 | ||
6d52618b | 92 | /* Exponential function of X. */ |
f7eac6eb RM |
93 | __MATHCALL (exp,, (_Mdouble_ __x)); |
94 | ||
95 | /* Break VALUE into a normalized fraction and an integral power of 2. */ | |
afd4eb37 | 96 | __MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent)); |
f7eac6eb RM |
97 | |
98 | /* X times (two to the EXP power). */ | |
afd4eb37 | 99 | __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent)); |
f7eac6eb RM |
100 | |
101 | /* Natural logarithm of X. */ | |
102 | __MATHCALL (log,, (_Mdouble_ __x)); | |
103 | ||
104 | /* Base-ten logarithm of X. */ | |
105 | __MATHCALL (log10,, (_Mdouble_ __x)); | |
106 | ||
377a515b UD |
107 | /* Break VALUE into integral and fractional parts. */ |
108 | __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)); | |
109 | ||
110 | #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X | |
f7eac6eb RM |
111 | /* Return exp(X) - 1. */ |
112 | __MATHCALL (expm1,, (_Mdouble_ __x)); | |
113 | ||
114 | /* Return log(1 + X). */ | |
115 | __MATHCALL (log1p,, (_Mdouble_ __x)); | |
2c6fe0bd UD |
116 | |
117 | /* Return the base 2 signed integral exponent of X. */ | |
118 | __MATHCALL (logb,, (_Mdouble_ __x)); | |
f7eac6eb RM |
119 | #endif |
120 | ||
377a515b UD |
121 | #ifdef __USE_ISOC9X |
122 | /* Compute base-2 exponential of X. */ | |
123 | __MATHCALL (exp2,, (_Mdouble_ __x)); | |
124 | ||
125 | /* Compute base-2 logarithm of X. */ | |
126 | __MATHCALL (log2,, (_Mdouble_ __x)); | |
127 | #endif | |
f7eac6eb RM |
128 | |
129 | ||
130 | /* Power functions. */ | |
131 | ||
132 | /* Return X to the Y power. */ | |
133 | __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | |
134 | ||
135 | /* Return the square root of X. */ | |
136 | __MATHCALL (sqrt,, (_Mdouble_ __x)); | |
137 | ||
377a515b UD |
138 | #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X |
139 | /* Return `sqrt(X*X + Y*Y)'. */ | |
140 | __MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); | |
377a515b | 141 | |
f7eac6eb RM |
142 | /* Return the cube root of X. */ |
143 | __MATHCALL (cbrt,, (_Mdouble_ __x)); | |
144 | #endif | |
145 | ||
146 | ||
147 | /* Nearest integer, absolute value, and remainder functions. */ | |
148 | ||
149 | /* Smallest integral value not less than X. */ | |
150 | __MATHCALL (ceil,, (_Mdouble_ __x)); | |
151 | ||
152 | /* Absolute value of X. */ | |
3e5f5557 | 153 | __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); |
f7eac6eb RM |
154 | |
155 | /* Largest integer not greater than X. */ | |
156 | __MATHCALL (floor,, (_Mdouble_ __x)); | |
157 | ||
158 | /* Floating-point modulo remainder of X/Y. */ | |
159 | __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); | |
160 | ||
161 | ||
162 | #ifdef __USE_MISC | |
f7eac6eb RM |
163 | /* Return 0 if VALUE is finite or NaN, +1 if it |
164 | is +Infinity, -1 if it is -Infinity. */ | |
3e5f5557 | 165 | __MATHDECLX (int,isinf,, (_Mdouble_ __value), (__const__)); |
f7eac6eb | 166 | |
f7eac6eb | 167 | /* Return nonzero if VALUE is finite and not NaN. */ |
3e5f5557 | 168 | __MATHDECLX (int,finite,, (_Mdouble_ __value), (__const__)); |
f7eac6eb RM |
169 | |
170 | /* Deal with an infinite or NaN result. | |
171 | If ERROR is ERANGE, result is +Inf; | |
172 | if ERROR is - ERANGE, result is -Inf; | |
173 | otherwise result is NaN. | |
174 | This will set `errno' to either ERANGE or EDOM, | |
175 | and may return an infinity or NaN, or may do something else. */ | |
3e5f5557 | 176 | __MATHCALLX (infnan,, (int __error), (__const__)); |
f7eac6eb | 177 | |
f7eac6eb RM |
178 | /* Return the remainder of X/Y. */ |
179 | __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)); | |
180 | ||
f7eac6eb | 181 | |
2c6fe0bd UD |
182 | /* Return the fractional part of X after dividing out `ilogb (X)'. */ |
183 | __MATHCALL (significand,, (_Mdouble_ __x)); | |
184 | #endif /* Use misc. */ | |
f7eac6eb | 185 | |
377a515b UD |
186 | #if defined __USE_MISC || defined __USE_ISOC9X |
187 | /* Return X with its signed changed to Y's. */ | |
3e5f5557 | 188 | __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); |
377a515b UD |
189 | #endif |
190 | ||
191 | #ifdef __USE_ISOC9X | |
192 | /* Return representation of NaN for double type. */ | |
3e5f5557 | 193 | __MATHCALLX (nan,, (__const char *__tagb), (__const__)); |
377a515b | 194 | #endif |
2c6fe0bd | 195 | |
2c6fe0bd | 196 | |
377a515b | 197 | #if defined __USE_MISC || defined __USE_XOPEN |
2c6fe0bd | 198 | /* Return nonzero if VALUE is not a number. */ |
3e5f5557 | 199 | __MATHDECLX (int,isnan,, (_Mdouble_ __value), (__const__)); |
f7eac6eb | 200 | |
377a515b UD |
201 | /* Bessel functions. */ |
202 | __MATHCALL (j0,, (_Mdouble_)); | |
203 | __MATHCALL (j1,, (_Mdouble_)); | |
204 | __MATHCALL (jn,, (int, _Mdouble_)); | |
205 | __MATHCALL (y0,, (_Mdouble_)); | |
206 | __MATHCALL (y1,, (_Mdouble_)); | |
207 | __MATHCALL (yn,, (int, _Mdouble_)); | |
208 | #endif | |
f7eac6eb RM |
209 | |
210 | ||
377a515b | 211 | #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC9X |
f7eac6eb RM |
212 | /* Error, gamma, and Bessel functions. */ |
213 | __MATHCALL (erf,, (_Mdouble_)); | |
214 | __MATHCALL (erfc,, (_Mdouble_)); | |
215 | __MATHCALL (gamma,, (_Mdouble_)); | |
f7eac6eb | 216 | __MATHCALL (lgamma,, (_Mdouble_)); |
d705269e | 217 | #endif |
f7eac6eb | 218 | |
19361cb7 | 219 | #ifdef __USE_MISC |
f7eac6eb RM |
220 | /* Reentrant versions of gamma and lgamma. Those functions use the global |
221 | variable `signgam'. The reentrant versions instead take a pointer and | |
222 | store the value through it. */ | |
223 | __MATHCALL (gamma,_r, (_Mdouble_, int *)); | |
224 | __MATHCALL (lgamma,_r, (_Mdouble_, int *)); | |
225 | #endif | |
226 | ||
2c6fe0bd | 227 | |
377a515b | 228 | #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X |
2c6fe0bd UD |
229 | /* Return the integer nearest X in the direction of the |
230 | prevailing rounding mode. */ | |
231 | __MATHCALL (rint,, (_Mdouble_ __x)); | |
232 | ||
2c6fe0bd | 233 | /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ |
3e5f5557 | 234 | __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); |
dfd2257a UD |
235 | #ifdef __USE_ISOC9X |
236 | __MATHCALLX (nextafterx,, (_Mdouble_ __x, long double __y), (__const__)); | |
237 | #endif | |
2c6fe0bd UD |
238 | |
239 | /* Return the remainder of integer divison X / Y with infinite precision. */ | |
240 | __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); | |
2c6fe0bd | 241 | |
377a515b UD |
242 | /* Return X times (2 to the Nth power). */ |
243 | __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); | |
d705269e UD |
244 | |
245 | /* Return X times (2 to the Nth power). */ | |
dfd2257a | 246 | __MATHCALL (scalbn,, (_Mdouble_ __x, int __n)); |
d705269e UD |
247 | |
248 | /* Return the binary exponent of X, which must be nonzero. */ | |
249 | __MATHDECL (int,ilogb,, (_Mdouble_ __x)); | |
377a515b UD |
250 | #endif |
251 | ||
252 | #ifdef __USE_ISOC9X | |
dfd2257a UD |
253 | /* Return X times (2 to the Nth power). */ |
254 | __MATHCALL (scalbln,, (_Mdouble_ __x, long int __n)); | |
255 | ||
377a515b UD |
256 | /* Round X to integral valuein floating-point format using current |
257 | rounding direction, but do not raise inexact exception. */ | |
258 | __MATHCALL (nearbyint,, (_Mdouble_ __x)); | |
259 | ||
260 | /* Round X to nearest integral value, rounding halfway cases away from | |
261 | zero. */ | |
262 | __MATHCALL (round,, (_Mdouble_ __x)); | |
263 | ||
264 | /* Round X to the integral value in floating-point format nearest but | |
265 | not larger in magnitude. */ | |
3e5f5557 | 266 | __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)); |
377a515b UD |
267 | |
268 | /* Compute remainder of X and Y and put in *QUO a value with sign of x/y | |
269 | and magnitude congruent `mod 2^n' to the magnitude of the integral | |
270 | quotient x/y, with n >= 3. */ | |
271 | __MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); | |
272 | ||
273 | ||
dfd2257a UD |
274 | /* Conversion functions. */ |
275 | ||
276 | /* Round X to nearest integral value according to current rounding | |
277 | direction. */ | |
278 | __MATHDECL (long int, lrint,, (_Mdouble_ __x)); | |
279 | __MATHDECL (long long int, llrint,, (_Mdouble_ __x)); | |
280 | ||
281 | /* Round X to nearest integral value, rounding halfway cases away from | |
282 | zero. */ | |
283 | __MATHDECL (long int, lround,, (_Mdouble_ __x)); | |
284 | __MATHDECL (long long int, llround,, (_Mdouble_ __x)); | |
285 | ||
286 | ||
377a515b UD |
287 | /* Return positive difference between X and Y. */ |
288 | __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); | |
289 | ||
4cca6b86 | 290 | /* Return maximum numeric value from X and Y. */ |
377a515b UD |
291 | __MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y)); |
292 | ||
4cca6b86 | 293 | /* Return minimum numeric value from X and Y. */ |
377a515b UD |
294 | __MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y)); |
295 | ||
296 | ||
297 | /* Classify given number. */ | |
3e5f5557 UD |
298 | __MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value)) |
299 | __attribute__ ((__const__)); | |
377a515b UD |
300 | |
301 | /* Test for negative number. */ | |
3e5f5557 UD |
302 | __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) |
303 | __attribute__ ((__const__)); | |
dfd2257a UD |
304 | |
305 | ||
306 | /* Multiply-add function computed as a ternary operation. */ | |
307 | __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); | |
377a515b | 308 | #endif /* Use ISO C 9X. */ |