]>
Commit | Line | Data |
---|---|---|
f7eac6eb | 1 | /* Prototype declarations for math functions; helper file for <math.h>. |
f7a9f785 | 2 | Copyright (C) 1996-2016 Free Software Foundation, Inc. |
2c6fe0bd | 3 | This file is part of the GNU C Library. |
f7eac6eb | 4 | |
2c6fe0bd | 5 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the 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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
f7eac6eb | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
f7eac6eb RM |
18 | |
19 | /* NOTE: Because of the special way this file is used by <math.h>, this | |
20 | file must NOT be protected from multiple inclusion as header files | |
21 | usually are. | |
22 | ||
23 | This file provides prototype declarations for the math functions. | |
24 | Most functions are declared using the macro: | |
25 | ||
26 | __MATHCALL (NAME,[_r], (ARGS...)); | |
27 | ||
28 | This means there is a function `NAME' returning `double' and a function | |
29 | `NAMEf' returning `float'. Each place `_Mdouble_' appears in the | |
30 | prototype, that is actually `double' in the prototype for `NAME' and | |
31 | `float' in the prototype for `NAMEf'. Reentrant variant functions are | |
32 | called `NAME_r' and `NAMEf_r'. | |
33 | ||
34 | Functions returning other types like `int' are declared using the macro: | |
35 | ||
36 | __MATHDECL (TYPE, NAME,[_r], (ARGS...)); | |
37 | ||
38 | This is just like __MATHCALL but for a function returning `TYPE' | |
39 | instead of `_Mdouble_'. In all of these cases, there is still | |
af6f3906 | 40 | both a `NAME' and a `NAMEf' that takes `float' arguments. |
4bbac92a | 41 | |
af6f3906 UD |
42 | Note that there must be no whitespace before the argument passed for |
43 | NAME, to make token pasting work with -traditional. */ | |
f7eac6eb RM |
44 | |
45 | #ifndef _MATH_H | |
7a5affeb | 46 | # error "Never include <bits/mathcalls.h> directly; include <math.h> instead." |
f7eac6eb RM |
47 | #endif |
48 | ||
49 | ||
50 | /* Trigonometric functions. */ | |
51 | ||
7a5affeb | 52 | _Mdouble_BEGIN_NAMESPACE |
f7eac6eb RM |
53 | /* Arc cosine of X. */ |
54 | __MATHCALL (acos,, (_Mdouble_ __x)); | |
55 | /* Arc sine of X. */ | |
56 | __MATHCALL (asin,, (_Mdouble_ __x)); | |
57 | /* Arc tangent of X. */ | |
58 | __MATHCALL (atan,, (_Mdouble_ __x)); | |
59 | /* Arc tangent of Y/X. */ | |
60 | __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); | |
61 | ||
62 | /* Cosine of X. */ | |
21933112 | 63 | __MATHCALL_VEC (cos,, (_Mdouble_ __x)); |
f7eac6eb | 64 | /* Sine of X. */ |
4b9c2b70 | 65 | __MATHCALL_VEC (sin,, (_Mdouble_ __x)); |
f7eac6eb RM |
66 | /* Tangent of X. */ |
67 | __MATHCALL (tan,, (_Mdouble_ __x)); | |
68 | ||
f7eac6eb RM |
69 | /* Hyperbolic functions. */ |
70 | ||
71 | /* Hyperbolic cosine of X. */ | |
72 | __MATHCALL (cosh,, (_Mdouble_ __x)); | |
73 | /* Hyperbolic sine of X. */ | |
74 | __MATHCALL (sinh,, (_Mdouble_ __x)); | |
75 | /* Hyperbolic tangent of X. */ | |
76 | __MATHCALL (tanh,, (_Mdouble_ __x)); | |
7a5affeb UD |
77 | _Mdouble_END_NAMESPACE |
78 | ||
79 | #ifdef __USE_GNU | |
80 | /* Cosine and sine of X. */ | |
c9a8c526 AS |
81 | __MATHDECL_VEC (void,sincos,, |
82 | (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); | |
7a5affeb | 83 | #endif |
f7eac6eb | 84 | |
acd7f096 | 85 | #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 |
7a5affeb | 86 | __BEGIN_NAMESPACE_C99 |
f7eac6eb RM |
87 | /* Hyperbolic arc cosine of X. */ |
88 | __MATHCALL (acosh,, (_Mdouble_ __x)); | |
89 | /* Hyperbolic arc sine of X. */ | |
90 | __MATHCALL (asinh,, (_Mdouble_ __x)); | |
91 | /* Hyperbolic arc tangent of X. */ | |
92 | __MATHCALL (atanh,, (_Mdouble_ __x)); | |
7a5affeb | 93 | __END_NAMESPACE_C99 |
f7eac6eb RM |
94 | #endif |
95 | ||
96 | /* Exponential and logarithmic functions. */ | |
97 | ||
7a5affeb | 98 | _Mdouble_BEGIN_NAMESPACE |
6d52618b | 99 | /* Exponential function of X. */ |
9c02f663 | 100 | __MATHCALL_VEC (exp,, (_Mdouble_ __x)); |
f7eac6eb RM |
101 | |
102 | /* Break VALUE into a normalized fraction and an integral power of 2. */ | |
afd4eb37 | 103 | __MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent)); |
f7eac6eb RM |
104 | |
105 | /* X times (two to the EXP power). */ | |
afd4eb37 | 106 | __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent)); |
f7eac6eb RM |
107 | |
108 | /* Natural logarithm of X. */ | |
6af25acc | 109 | __MATHCALL_VEC (log,, (_Mdouble_ __x)); |
f7eac6eb RM |
110 | |
111 | /* Base-ten logarithm of X. */ | |
112 | __MATHCALL (log10,, (_Mdouble_ __x)); | |
113 | ||
377a515b | 114 | /* Break VALUE into integral and fractional parts. */ |
9c89fca6 | 115 | __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2)); |
7a5affeb UD |
116 | _Mdouble_END_NAMESPACE |
117 | ||
118 | #ifdef __USE_GNU | |
119 | /* A function missing in all standards: compute exponent to base ten. */ | |
120 | __MATHCALL (exp10,, (_Mdouble_ __x)); | |
121 | /* Another name occasionally used. */ | |
122 | __MATHCALL (pow10,, (_Mdouble_ __x)); | |
123 | #endif | |
377a515b | 124 | |
acd7f096 | 125 | #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 |
7a5affeb | 126 | __BEGIN_NAMESPACE_C99 |
f7eac6eb RM |
127 | /* Return exp(X) - 1. */ |
128 | __MATHCALL (expm1,, (_Mdouble_ __x)); | |
129 | ||
130 | /* Return log(1 + X). */ | |
131 | __MATHCALL (log1p,, (_Mdouble_ __x)); | |
2c6fe0bd UD |
132 | |
133 | /* Return the base 2 signed integral exponent of X. */ | |
134 | __MATHCALL (logb,, (_Mdouble_ __x)); | |
7a5affeb | 135 | __END_NAMESPACE_C99 |
f7eac6eb RM |
136 | #endif |
137 | ||
ec751a23 | 138 | #ifdef __USE_ISOC99 |
7a5affeb | 139 | __BEGIN_NAMESPACE_C99 |
377a515b UD |
140 | /* Compute base-2 exponential of X. */ |
141 | __MATHCALL (exp2,, (_Mdouble_ __x)); | |
142 | ||
143 | /* Compute base-2 logarithm of X. */ | |
144 | __MATHCALL (log2,, (_Mdouble_ __x)); | |
7a5affeb | 145 | __END_NAMESPACE_C99 |
377a515b | 146 | #endif |
f7eac6eb RM |
147 | |
148 | ||
149 | /* Power functions. */ | |
150 | ||
7a5affeb | 151 | _Mdouble_BEGIN_NAMESPACE |
f7eac6eb | 152 | /* Return X to the Y power. */ |
c10b9b13 | 153 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); |
f7eac6eb RM |
154 | |
155 | /* Return the square root of X. */ | |
156 | __MATHCALL (sqrt,, (_Mdouble_ __x)); | |
7a5affeb | 157 | _Mdouble_END_NAMESPACE |
f7eac6eb | 158 | |
acd7f096 | 159 | #if defined __USE_XOPEN || defined __USE_ISOC99 |
7a5affeb | 160 | __BEGIN_NAMESPACE_C99 |
377a515b UD |
161 | /* Return `sqrt(X*X + Y*Y)'. */ |
162 | __MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); | |
7a5affeb | 163 | __END_NAMESPACE_C99 |
e918a7fe | 164 | #endif |
377a515b | 165 | |
acd7f096 | 166 | #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 |
7a5affeb | 167 | __BEGIN_NAMESPACE_C99 |
f7eac6eb RM |
168 | /* Return the cube root of X. */ |
169 | __MATHCALL (cbrt,, (_Mdouble_ __x)); | |
7a5affeb | 170 | __END_NAMESPACE_C99 |
f7eac6eb RM |
171 | #endif |
172 | ||
173 | ||
174 | /* Nearest integer, absolute value, and remainder functions. */ | |
175 | ||
7a5affeb | 176 | _Mdouble_BEGIN_NAMESPACE |
f7eac6eb | 177 | /* Smallest integral value not less than X. */ |
f4efd068 | 178 | __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); |
f7eac6eb RM |
179 | |
180 | /* Absolute value of X. */ | |
3e5f5557 | 181 | __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); |
f7eac6eb RM |
182 | |
183 | /* Largest integer not greater than X. */ | |
f4efd068 | 184 | __MATHCALLX (floor,, (_Mdouble_ __x), (__const__)); |
f7eac6eb RM |
185 | |
186 | /* Floating-point modulo remainder of X/Y. */ | |
187 | __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); | |
188 | ||
189 | ||
bfce746a UD |
190 | /* Return 0 if VALUE is finite or NaN, +1 if it |
191 | is +Infinity, -1 if it is -Infinity. */ | |
192 | __MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); | |
193 | ||
a1648746 UD |
194 | /* Return nonzero if VALUE is finite and not NaN. */ |
195 | __MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); | |
7a5affeb | 196 | _Mdouble_END_NAMESPACE |
a1648746 | 197 | |
f7eac6eb | 198 | #ifdef __USE_MISC |
d9b965fa | 199 | # if !defined __cplusplus || __cplusplus < 201103L /* Conflicts with C++11. */ |
f7eac6eb RM |
200 | /* Return 0 if VALUE is finite or NaN, +1 if it |
201 | is +Infinity, -1 if it is -Infinity. */ | |
bfce746a | 202 | __MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); |
d9b965fa | 203 | # endif |
f7eac6eb | 204 | |
f7eac6eb | 205 | /* Return nonzero if VALUE is finite and not NaN. */ |
a1648746 | 206 | __MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); |
f7eac6eb | 207 | |
f7eac6eb RM |
208 | /* Return the remainder of X/Y. */ |
209 | __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)); | |
210 | ||
f7eac6eb | 211 | |
2c6fe0bd UD |
212 | /* Return the fractional part of X after dividing out `ilogb (X)'. */ |
213 | __MATHCALL (significand,, (_Mdouble_ __x)); | |
214 | #endif /* Use misc. */ | |
f7eac6eb | 215 | |
acd7f096 | 216 | #ifdef __USE_ISOC99 |
7a5affeb | 217 | __BEGIN_NAMESPACE_C99 |
377a515b | 218 | /* Return X with its signed changed to Y's. */ |
3e5f5557 | 219 | __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); |
7a5affeb | 220 | __END_NAMESPACE_C99 |
377a515b UD |
221 | #endif |
222 | ||
ec751a23 | 223 | #ifdef __USE_ISOC99 |
7a5affeb | 224 | __BEGIN_NAMESPACE_C99 |
67e971f1 | 225 | /* Return representation of qNaN for double type. */ |
a784e502 | 226 | __MATHCALLX (nan,, (const char *__tagb), (__const__)); |
7a5affeb | 227 | __END_NAMESPACE_C99 |
377a515b | 228 | #endif |
2c6fe0bd | 229 | |
2c6fe0bd | 230 | |
68337808 | 231 | /* Return nonzero if VALUE is not a number. */ |
a1648746 | 232 | __MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); |
68337808 | 233 | |
de20571d | 234 | #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) |
d9b965fa | 235 | # if !defined __cplusplus || __cplusplus < 201103L /* Conflicts with C++11. */ |
2c6fe0bd | 236 | /* Return nonzero if VALUE is not a number. */ |
a1648746 | 237 | __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); |
d9b965fa | 238 | # endif |
de20571d | 239 | #endif |
f7eac6eb | 240 | |
1f11365a | 241 | #if defined __USE_MISC || (defined __USE_XOPEN && __MATH_DECLARING_DOUBLE) |
377a515b UD |
242 | /* Bessel functions. */ |
243 | __MATHCALL (j0,, (_Mdouble_)); | |
244 | __MATHCALL (j1,, (_Mdouble_)); | |
245 | __MATHCALL (jn,, (int, _Mdouble_)); | |
246 | __MATHCALL (y0,, (_Mdouble_)); | |
247 | __MATHCALL (y1,, (_Mdouble_)); | |
248 | __MATHCALL (yn,, (int, _Mdouble_)); | |
249 | #endif | |
f7eac6eb RM |
250 | |
251 | ||
acd7f096 | 252 | #if defined __USE_XOPEN || defined __USE_ISOC99 |
7a5affeb | 253 | __BEGIN_NAMESPACE_C99 |
7d6a8338 | 254 | /* Error and gamma functions. */ |
f7eac6eb RM |
255 | __MATHCALL (erf,, (_Mdouble_)); |
256 | __MATHCALL (erfc,, (_Mdouble_)); | |
f7eac6eb | 257 | __MATHCALL (lgamma,, (_Mdouble_)); |
7a5affeb | 258 | __END_NAMESPACE_C99 |
0ed99ce4 UD |
259 | #endif |
260 | ||
261 | #ifdef __USE_ISOC99 | |
7a5affeb UD |
262 | __BEGIN_NAMESPACE_C99 |
263 | /* True gamma function. */ | |
e852e889 | 264 | __MATHCALL (tgamma,, (_Mdouble_)); |
7a5affeb | 265 | __END_NAMESPACE_C99 |
e852e889 UD |
266 | #endif |
267 | ||
de20571d | 268 | #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) |
7d6a8338 | 269 | /* Obsolete alias for `lgamma'. */ |
e852e889 | 270 | __MATHCALL (gamma,, (_Mdouble_)); |
d705269e | 271 | #endif |
f7eac6eb | 272 | |
19361cb7 | 273 | #ifdef __USE_MISC |
7d6a8338 UD |
274 | /* Reentrant version of lgamma. This function uses the global variable |
275 | `signgam'. The reentrant version instead takes a pointer and stores | |
276 | the value through it. */ | |
277 | __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); | |
f7eac6eb RM |
278 | #endif |
279 | ||
2c6fe0bd | 280 | |
acd7f096 | 281 | #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 |
7a5affeb | 282 | __BEGIN_NAMESPACE_C99 |
2c6fe0bd UD |
283 | /* Return the integer nearest X in the direction of the |
284 | prevailing rounding mode. */ | |
285 | __MATHCALL (rint,, (_Mdouble_ __x)); | |
286 | ||
2c6fe0bd | 287 | /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ |
3e5f5557 | 288 | __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); |
c6251f03 | 289 | # if defined __USE_ISOC99 && !defined __LDBL_COMPAT |
36fe9ac9 | 290 | __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__)); |
bfce746a | 291 | # endif |
2c6fe0bd UD |
292 | |
293 | /* Return the remainder of integer divison X / Y with infinite precision. */ | |
294 | __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); | |
2c6fe0bd | 295 | |
acd7f096 | 296 | # ifdef __USE_ISOC99 |
d705269e | 297 | /* Return X times (2 to the Nth power). */ |
dfd2257a | 298 | __MATHCALL (scalbn,, (_Mdouble_ __x, int __n)); |
0ed99ce4 | 299 | # endif |
d705269e UD |
300 | |
301 | /* Return the binary exponent of X, which must be nonzero. */ | |
302 | __MATHDECL (int,ilogb,, (_Mdouble_ __x)); | |
377a515b UD |
303 | #endif |
304 | ||
ec751a23 | 305 | #ifdef __USE_ISOC99 |
dfd2257a UD |
306 | /* Return X times (2 to the Nth power). */ |
307 | __MATHCALL (scalbln,, (_Mdouble_ __x, long int __n)); | |
308 | ||
4caef86c | 309 | /* Round X to integral value in floating-point format using current |
377a515b UD |
310 | rounding direction, but do not raise inexact exception. */ |
311 | __MATHCALL (nearbyint,, (_Mdouble_ __x)); | |
312 | ||
313 | /* Round X to nearest integral value, rounding halfway cases away from | |
314 | zero. */ | |
27caaf41 | 315 | __MATHCALLX (round,, (_Mdouble_ __x), (__const__)); |
377a515b UD |
316 | |
317 | /* Round X to the integral value in floating-point format nearest but | |
318 | not larger in magnitude. */ | |
3e5f5557 | 319 | __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)); |
377a515b UD |
320 | |
321 | /* Compute remainder of X and Y and put in *QUO a value with sign of x/y | |
322 | and magnitude congruent `mod 2^n' to the magnitude of the integral | |
323 | quotient x/y, with n >= 3. */ | |
324 | __MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); | |
325 | ||
326 | ||
dfd2257a UD |
327 | /* Conversion functions. */ |
328 | ||
329 | /* Round X to nearest integral value according to current rounding | |
330 | direction. */ | |
af6f3906 | 331 | __MATHDECL (long int,lrint,, (_Mdouble_ __x)); |
828beb13 | 332 | __extension__ |
af6f3906 | 333 | __MATHDECL (long long int,llrint,, (_Mdouble_ __x)); |
dfd2257a UD |
334 | |
335 | /* Round X to nearest integral value, rounding halfway cases away from | |
336 | zero. */ | |
af6f3906 | 337 | __MATHDECL (long int,lround,, (_Mdouble_ __x)); |
828beb13 | 338 | __extension__ |
af6f3906 | 339 | __MATHDECL (long long int,llround,, (_Mdouble_ __x)); |
dfd2257a UD |
340 | |
341 | ||
377a515b UD |
342 | /* Return positive difference between X and Y. */ |
343 | __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); | |
344 | ||
4cca6b86 | 345 | /* Return maximum numeric value from X and Y. */ |
e58ef0f2 | 346 | __MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); |
377a515b | 347 | |
4cca6b86 | 348 | /* Return minimum numeric value from X and Y. */ |
e58ef0f2 | 349 | __MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); |
377a515b UD |
350 | |
351 | ||
352 | /* Classify given number. */ | |
3e5f5557 UD |
353 | __MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value)) |
354 | __attribute__ ((__const__)); | |
377a515b UD |
355 | |
356 | /* Test for negative number. */ | |
3e5f5557 UD |
357 | __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) |
358 | __attribute__ ((__const__)); | |
dfd2257a UD |
359 | |
360 | ||
361 | /* Multiply-add function computed as a ternary operation. */ | |
362 | __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); | |
d36421fa RM |
363 | #endif /* Use ISO C99. */ |
364 | ||
acd7f096 | 365 | #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 |
7a5affeb | 366 | __END_NAMESPACE_C99 |
d36421fa | 367 | #endif |
7a5affeb | 368 | |
57267616 TS |
369 | #ifdef __USE_GNU |
370 | /* Test for signaling NaN. */ | |
371 | __MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value)) | |
372 | __attribute__ ((__const__)); | |
373 | #endif | |
374 | ||
de20571d JM |
375 | #if defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ |
376 | && __MATH_DECLARING_DOUBLE \ | |
377 | && !defined __USE_XOPEN2K8) | |
7a5affeb UD |
378 | /* Return X times (2 to the Nth power). */ |
379 | __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); | |
d36421fa | 380 | #endif |