1/* Prototype declarations for math functions; helper file for <math.h>.
2 Copyright (C) 1996-2016 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
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.
9
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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
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
40 both a `NAME' and a `NAMEf' that takes `float' arguments.
41
42 Note that there must be no whitespace before the argument passed for
43 NAME, to make token pasting work with -traditional. */
44
45#ifndef _MATH_H
46# error "Never include <bits/mathcalls.h> directly; include <math.h> instead."
47#endif
48
49
50/* Trigonometric functions. */
51
52_Mdouble_BEGIN_NAMESPACE
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. */
63__MATHCALL_VEC (cos,, (_Mdouble_ __x));
64/* Sine of X. */
65__MATHCALL_VEC (sin,, (_Mdouble_ __x));
66/* Tangent of X. */
67__MATHCALL (tan,, (_Mdouble_ __x));
68
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));
77_Mdouble_END_NAMESPACE
78
79#ifdef __USE_GNU
80/* Cosine and sine of X. */
81__MATHDECL_VEC (void,sincos,,
82 (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
83#endif
84
85#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
86__BEGIN_NAMESPACE_C99
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));
93__END_NAMESPACE_C99
94#endif
95
96/* Exponential and logarithmic functions. */
97
98_Mdouble_BEGIN_NAMESPACE
99/* Exponential function of X. */
100__MATHCALL_VEC (exp,, (_Mdouble_ __x));
101
102/* Break VALUE into a normalized fraction and an integral power of 2. */
103__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
104
105/* X times (two to the EXP power). */
106__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
107
108/* Natural logarithm of X. */
109__MATHCALL_VEC (log,, (_Mdouble_ __x));
110
111/* Base-ten logarithm of X. */
112__MATHCALL (log10,, (_Mdouble_ __x));
113
114/* Break VALUE into integral and fractional parts. */
115__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
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
124
125#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
126__BEGIN_NAMESPACE_C99
127/* Return exp(X) - 1. */
128__MATHCALL (expm1,, (_Mdouble_ __x));
129
130/* Return log(1 + X). */
131__MATHCALL (log1p,, (_Mdouble_ __x));
132
133/* Return the base 2 signed integral exponent of X. */
134__MATHCALL (logb,, (_Mdouble_ __x));
135__END_NAMESPACE_C99
136#endif
137
138#ifdef __USE_ISOC99
139__BEGIN_NAMESPACE_C99
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));
145__END_NAMESPACE_C99
146#endif
147
148
149/* Power functions. */
150
151_Mdouble_BEGIN_NAMESPACE
152/* Return X to the Y power. */
153__MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
154
155/* Return the square root of X. */
156__MATHCALL (sqrt,, (_Mdouble_ __x));
157_Mdouble_END_NAMESPACE
158
159#if defined __USE_XOPEN || defined __USE_ISOC99
160__BEGIN_NAMESPACE_C99
161/* Return `sqrt(X*X + Y*Y)'. */
162__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
163__END_NAMESPACE_C99
164#endif
165
166#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
167__BEGIN_NAMESPACE_C99
168/* Return the cube root of X. */
169__MATHCALL (cbrt,, (_Mdouble_ __x));
170__END_NAMESPACE_C99
171#endif
172
173
174/* Nearest integer, absolute value, and remainder functions. */
175
176_Mdouble_BEGIN_NAMESPACE
177/* Smallest integral value not less than X. */
178__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
179
180/* Absolute value of X. */
181__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
182
183/* Largest integer not greater than X. */
184__MATHCALLX (floor,, (_Mdouble_ __x), (__const__));
185
186/* Floating-point modulo remainder of X/Y. */
187__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
188
189
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
194/* Return nonzero if VALUE is finite and not NaN. */
195__MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
196_Mdouble_END_NAMESPACE
197
198#ifdef __USE_MISC
199# if (!defined __cplusplus \
200 || __cplusplus < 201103L /* isinf conflicts with C++11. */ \
201 || __MATH_DECLARING_DOUBLE == 0) /* isinff or isinfl don't. */
202/* Return 0 if VALUE is finite or NaN, +1 if it
203 is +Infinity, -1 if it is -Infinity. */
204__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
205# endif
206
207/* Return nonzero if VALUE is finite and not NaN. */
208__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
209
210/* Return the remainder of X/Y. */
211__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
212
213
214/* Return the fractional part of X after dividing out `ilogb (X)'. */
215__MATHCALL (significand,, (_Mdouble_ __x));
216#endif /* Use misc. */
217
218#ifdef __USE_ISOC99
219__BEGIN_NAMESPACE_C99
220/* Return X with its signed changed to Y's. */
221__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
222__END_NAMESPACE_C99
223#endif
224
225#ifdef __USE_ISOC99
226__BEGIN_NAMESPACE_C99
227/* Return representation of qNaN for double type. */
228__MATHCALLX (nan,, (const char *__tagb), (__const__));
229__END_NAMESPACE_C99
230#endif
231
232
233/* Return nonzero if VALUE is not a number. */
234__MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
235
236#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
237# if (!defined __cplusplus \
238 || __cplusplus < 201103L /* isnan conflicts with C++11. */ \
239 || __MATH_DECLARING_DOUBLE == 0) /* isnanf or isnanl don't. */
240/* Return nonzero if VALUE is not a number. */
241__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
242# endif
243#endif
244
245#if defined __USE_MISC || (defined __USE_XOPEN && __MATH_DECLARING_DOUBLE)
246/* Bessel functions. */
247__MATHCALL (j0,, (_Mdouble_));
248__MATHCALL (j1,, (_Mdouble_));
249__MATHCALL (jn,, (int, _Mdouble_));
250__MATHCALL (y0,, (_Mdouble_));
251__MATHCALL (y1,, (_Mdouble_));
252__MATHCALL (yn,, (int, _Mdouble_));
253#endif
254
255
256#if defined __USE_XOPEN || defined __USE_ISOC99
257__BEGIN_NAMESPACE_C99
258/* Error and gamma functions. */
259__MATHCALL (erf,, (_Mdouble_));
260__MATHCALL (erfc,, (_Mdouble_));
261__MATHCALL (lgamma,, (_Mdouble_));
262__END_NAMESPACE_C99
263#endif
264
265#ifdef __USE_ISOC99
266__BEGIN_NAMESPACE_C99
267/* True gamma function. */
268__MATHCALL (tgamma,, (_Mdouble_));
269__END_NAMESPACE_C99
270#endif
271
272#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
273/* Obsolete alias for `lgamma'. */
274__MATHCALL (gamma,, (_Mdouble_));
275#endif
276
277#ifdef __USE_MISC
278/* Reentrant version of lgamma. This function uses the global variable
279 `signgam'. The reentrant version instead takes a pointer and stores
280 the value through it. */
281__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
282#endif
283
284
285#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
286__BEGIN_NAMESPACE_C99
287/* Return the integer nearest X in the direction of the
288 prevailing rounding mode. */
289__MATHCALL (rint,, (_Mdouble_ __x));
290
291/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
292__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
293# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
294__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
295# endif
296
297#ifdef __USE_GNU
298/* Return X - epsilon. */
299__MATHCALL (nextdown,, (_Mdouble_ __x));
300/* Return X + epsilon. */
301__MATHCALL (nextup,, (_Mdouble_ __x));
302# endif
303
304/* Return the remainder of integer divison X / Y with infinite precision. */
305__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
306
307# ifdef __USE_ISOC99
308/* Return X times (2 to the Nth power). */
309__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
310# endif
311
312/* Return the binary exponent of X, which must be nonzero. */
313__MATHDECL (int,ilogb,, (_Mdouble_ __x));
314#endif
315
316#ifdef __USE_ISOC99
317/* Return X times (2 to the Nth power). */
318__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n));
319
320/* Round X to integral value in floating-point format using current
321 rounding direction, but do not raise inexact exception. */
322__MATHCALL (nearbyint,, (_Mdouble_ __x));
323
324/* Round X to nearest integral value, rounding halfway cases away from
325 zero. */
326__MATHCALLX (round,, (_Mdouble_ __x), (__const__));
327
328/* Round X to the integral value in floating-point format nearest but
329 not larger in magnitude. */
330__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
331
332/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
333 and magnitude congruent `mod 2^n' to the magnitude of the integral
334 quotient x/y, with n >= 3. */
335__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
336
337
338/* Conversion functions. */
339
340/* Round X to nearest integral value according to current rounding
341 direction. */
342__MATHDECL (long int,lrint,, (_Mdouble_ __x));
343__extension__
344__MATHDECL (long long int,llrint,, (_Mdouble_ __x));
345
346/* Round X to nearest integral value, rounding halfway cases away from
347 zero. */
348__MATHDECL (long int,lround,, (_Mdouble_ __x));
349__extension__
350__MATHDECL (long long int,llround,, (_Mdouble_ __x));
351
352
353/* Return positive difference between X and Y. */
354__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
355
356/* Return maximum numeric value from X and Y. */
357__MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
358
359/* Return minimum numeric value from X and Y. */
360__MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
361
362
363/* Classify given number. */
364__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
365 __attribute__ ((__const__));
366
367/* Test for negative number. */
368__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
369 __attribute__ ((__const__));
370
371
372/* Multiply-add function computed as a ternary operation. */
373__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
374#endif /* Use ISO C99. */
375
376#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
377__END_NAMESPACE_C99
378#endif
379
380#ifdef __USE_GNU
381/* Test for signaling NaN. */
382__MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value))
383 __attribute__ ((__const__));
384#endif
385
386#if defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
387 && __MATH_DECLARING_DOUBLE \
388 && !defined __USE_XOPEN2K8)
389/* Return X times (2 to the Nth power). */
390__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
391#endif
392