1/* Prototype declarations for math functions; helper file for <math.h>.
2 Copyright (C) 1996-2022 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 <https://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/* Arc cosine of X. */
53__MATHCALL_VEC (acos,, (_Mdouble_ __x));
54/* Arc sine of X. */
55__MATHCALL_VEC (asin,, (_Mdouble_ __x));
56/* Arc tangent of X. */
57__MATHCALL_VEC (atan,, (_Mdouble_ __x));
58/* Arc tangent of Y/X. */
59__MATHCALL_VEC (atan2,, (_Mdouble_ __y, _Mdouble_ __x));
60
61/* Cosine of X. */
62__MATHCALL_VEC (cos,, (_Mdouble_ __x));
63/* Sine of X. */
64__MATHCALL_VEC (sin,, (_Mdouble_ __x));
65/* Tangent of X. */
66__MATHCALL_VEC (tan,, (_Mdouble_ __x));
67
68/* Hyperbolic functions. */
69
70/* Hyperbolic cosine of X. */
71__MATHCALL_VEC (cosh,, (_Mdouble_ __x));
72/* Hyperbolic sine of X. */
73__MATHCALL_VEC (sinh,, (_Mdouble_ __x));
74/* Hyperbolic tangent of X. */
75__MATHCALL_VEC (tanh,, (_Mdouble_ __x));
76
77#ifdef __USE_GNU
78/* Cosine and sine of X. */
79__MATHDECL_VEC (void,sincos,,
80 (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
81#endif
82
83#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
84/* Hyperbolic arc cosine of X. */
85__MATHCALL_VEC (acosh,, (_Mdouble_ __x));
86/* Hyperbolic arc sine of X. */
87__MATHCALL_VEC (asinh,, (_Mdouble_ __x));
88/* Hyperbolic arc tangent of X. */
89__MATHCALL_VEC (atanh,, (_Mdouble_ __x));
90#endif
91
92/* Exponential and logarithmic functions. */
93
94/* Exponential function of X. */
95__MATHCALL_VEC (exp,, (_Mdouble_ __x));
96
97/* Break VALUE into a normalized fraction and an integral power of 2. */
98__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
99
100/* X times (two to the EXP power). */
101__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
102
103/* Natural logarithm of X. */
104__MATHCALL_VEC (log,, (_Mdouble_ __x));
105
106/* Base-ten logarithm of X. */
107__MATHCALL_VEC (log10,, (_Mdouble_ __x));
108
109/* Break VALUE into integral and fractional parts. */
110__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
111
112#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C2X)
113/* Compute exponent to base ten. */
114__MATHCALL_VEC (exp10,, (_Mdouble_ __x));
115#endif
116
117#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
118/* Return exp(X) - 1. */
119__MATHCALL_VEC (expm1,, (_Mdouble_ __x));
120
121/* Return log(1 + X). */
122__MATHCALL_VEC (log1p,, (_Mdouble_ __x));
123
124/* Return the base 2 signed integral exponent of X. */
125__MATHCALL (logb,, (_Mdouble_ __x));
126#endif
127
128#ifdef __USE_ISOC99
129/* Compute base-2 exponential of X. */
130__MATHCALL_VEC (exp2,, (_Mdouble_ __x));
131
132/* Compute base-2 logarithm of X. */
133__MATHCALL_VEC (log2,, (_Mdouble_ __x));
134#endif
135
136
137/* Power functions. */
138
139/* Return X to the Y power. */
140__MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
141
142/* Return the square root of X. */
143__MATHCALL (sqrt,, (_Mdouble_ __x));
144
145#if defined __USE_XOPEN || defined __USE_ISOC99
146/* Return `sqrt(X*X + Y*Y)'. */
147__MATHCALL_VEC (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
148#endif
149
150#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
151/* Return the cube root of X. */
152__MATHCALL_VEC (cbrt,, (_Mdouble_ __x));
153#endif
154
155
156/* Nearest integer, absolute value, and remainder functions. */
157
158/* Smallest integral value not less than X. */
159__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
160
161/* Absolute value of X. */
162__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
163
164/* Largest integer not greater than X. */
165__MATHCALLX (floor,, (_Mdouble_ __x), (__const__));
166
167/* Floating-point modulo remainder of X/Y. */
168__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
169
170#ifdef __USE_MISC
171# if ((!defined __cplusplus \
172 || __cplusplus < 201103L /* isinf conflicts with C++11. */ \
173 || __MATH_DECLARING_DOUBLE == 0)) /* isinff or isinfl don't. */ \
174 && !__MATH_DECLARING_FLOATN
175/* Return 0 if VALUE is finite or NaN, +1 if it
176 is +Infinity, -1 if it is -Infinity. */
177__MATHDECL_ALIAS (int,isinf,, (_Mdouble_ __value), isinf)
178 __attribute__ ((__const__));
179# endif
180
181# if !__MATH_DECLARING_FLOATN
182/* Return nonzero if VALUE is finite and not NaN. */
183__MATHDECL_ALIAS (int,finite,, (_Mdouble_ __value), finite)
184 __attribute__ ((__const__));
185
186/* Return the remainder of X/Y. */
187__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
188
189
190/* Return the fractional part of X after dividing out `ilogb (X)'. */
191__MATHCALL (significand,, (_Mdouble_ __x));
192# endif
193
194#endif /* Use misc. */
195
196#ifdef __USE_ISOC99
197/* Return X with its signed changed to Y's. */
198__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
199#endif
200
201#ifdef __USE_ISOC99
202/* Return representation of qNaN for double type. */
203__MATHCALL (nan,, (const char *__tagb));
204#endif
205
206
207#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
208# if ((!defined __cplusplus \
209 || __cplusplus < 201103L /* isnan conflicts with C++11. */ \
210 || __MATH_DECLARING_DOUBLE == 0)) /* isnanf or isnanl don't. */ \
211 && !__MATH_DECLARING_FLOATN
212/* Return nonzero if VALUE is not a number. */
213__MATHDECL_ALIAS (int,isnan,, (_Mdouble_ __value), isnan)
214 __attribute__ ((__const__));
215# endif
216#endif
217
218#if defined __USE_MISC || (defined __USE_XOPEN && __MATH_DECLARING_DOUBLE)
219/* Bessel functions. */
220__MATHCALL (j0,, (_Mdouble_));
221__MATHCALL (j1,, (_Mdouble_));
222__MATHCALL (jn,, (int, _Mdouble_));
223__MATHCALL (y0,, (_Mdouble_));
224__MATHCALL (y1,, (_Mdouble_));
225__MATHCALL (yn,, (int, _Mdouble_));
226#endif
227
228
229#if defined __USE_XOPEN || defined __USE_ISOC99
230/* Error and gamma functions. */
231__MATHCALL_VEC (erf,, (_Mdouble_));
232__MATHCALL_VEC (erfc,, (_Mdouble_));
233__MATHCALL (lgamma,, (_Mdouble_));
234#endif
235
236#ifdef __USE_ISOC99
237/* True gamma function. */
238__MATHCALL (tgamma,, (_Mdouble_));
239#endif
240
241#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
242# if !__MATH_DECLARING_FLOATN
243/* Obsolete alias for `lgamma'. */
244__MATHCALL (gamma,, (_Mdouble_));
245# endif
246#endif
247
248#ifdef __USE_MISC
249/* Reentrant version of lgamma. This function uses the global variable
250 `signgam'. The reentrant version instead takes a pointer and stores
251 the value through it. */
252__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
253#endif
254
255
256#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
257/* Return the integer nearest X in the direction of the
258 prevailing rounding mode. */
259__MATHCALL (rint,, (_Mdouble_ __x));
260
261/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
262__MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
263# if defined __USE_ISOC99 && !defined __LDBL_COMPAT && !__MATH_DECLARING_FLOATN
264__MATHCALL (nexttoward,, (_Mdouble_ __x, long double __y));
265# endif
266
267# if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) || __MATH_DECLARING_FLOATN
268/* Return X - epsilon. */
269__MATHCALL (nextdown,, (_Mdouble_ __x));
270/* Return X + epsilon. */
271__MATHCALL (nextup,, (_Mdouble_ __x));
272# endif
273
274/* Return the remainder of integer divison X / Y with infinite precision. */
275__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
276
277# ifdef __USE_ISOC99
278/* Return X times (2 to the Nth power). */
279__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
280# endif
281
282/* Return the binary exponent of X, which must be nonzero. */
283__MATHDECL (int,ilogb,, (_Mdouble_ __x));
284#endif
285
286#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) || __MATH_DECLARING_FLOATN
287/* Like ilogb, but returning long int. */
288__MATHDECL (long int, llogb,, (_Mdouble_ __x));
289#endif
290
291#ifdef __USE_ISOC99
292/* Return X times (2 to the Nth power). */
293__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n));
294
295/* Round X to integral value in floating-point format using current
296 rounding direction, but do not raise inexact exception. */
297__MATHCALL (nearbyint,, (_Mdouble_ __x));
298
299/* Round X to nearest integral value, rounding halfway cases away from
300 zero. */
301__MATHCALLX (round,, (_Mdouble_ __x), (__const__));
302
303/* Round X to the integral value in floating-point format nearest but
304 not larger in magnitude. */
305__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
306
307/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
308 and magnitude congruent `mod 2^n' to the magnitude of the integral
309 quotient x/y, with n >= 3. */
310__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
311
312
313/* Conversion functions. */
314
315/* Round X to nearest integral value according to current rounding
316 direction. */
317__MATHDECL (long int,lrint,, (_Mdouble_ __x));
318__extension__
319__MATHDECL (long long int,llrint,, (_Mdouble_ __x));
320
321/* Round X to nearest integral value, rounding halfway cases away from
322 zero. */
323__MATHDECL (long int,lround,, (_Mdouble_ __x));
324__extension__
325__MATHDECL (long long int,llround,, (_Mdouble_ __x));
326
327
328/* Return positive difference between X and Y. */
329__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
330
331# if !__MATH_DECLARING_FLOATN || defined __USE_GNU || !__GLIBC_USE (ISOC2X)
332/* Return maximum numeric value from X and Y. */
333__MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
334
335/* Return minimum numeric value from X and Y. */
336__MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
337# endif
338
339/* Multiply-add function computed as a ternary operation. */
340__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
341#endif /* Use ISO C99. */
342
343#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) || __MATH_DECLARING_FLOATN
344/* Round X to nearest integer value, rounding halfway cases to even. */
345__MATHCALLX (roundeven,, (_Mdouble_ __x), (__const__));
346
347/* Round X to nearest signed integer value, not raising inexact, with
348 control of rounding direction and width of result. */
349__MATHDECL (__intmax_t, fromfp,, (_Mdouble_ __x, int __round,
350 unsigned int __width));
351
352/* Round X to nearest unsigned integer value, not raising inexact,
353 with control of rounding direction and width of result. */
354__MATHDECL (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round,
355 unsigned int __width));
356
357/* Round X to nearest signed integer value, raising inexact for
358 non-integers, with control of rounding direction and width of
359 result. */
360__MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round,
361 unsigned int __width));
362
363/* Round X to nearest unsigned integer value, raising inexact for
364 non-integers, with control of rounding direction and width of
365 result. */
366__MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round,
367 unsigned int __width));
368
369/* Canonicalize floating-point representation. */
370__MATHDECL_1 (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x));
371#endif
372
373#if (__GLIBC_USE (IEC_60559_BFP_EXT) \
374 || (__MATH_DECLARING_FLOATN \
375 && (defined __USE_GNU || !__GLIBC_USE (ISOC2X))))
376/* Return value with maximum magnitude. */
377__MATHCALLX (fmaxmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
378
379/* Return value with minimum magnitude. */
380__MATHCALLX (fminmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
381#endif
382
383#if __GLIBC_USE (ISOC2X)
384/* Return maximum value from X and Y. */
385__MATHCALLX (fmaximum,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
386
387/* Return minimum value from X and Y. */
388__MATHCALLX (fminimum,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
389
390/* Return maximum numeric value from X and Y. */
391__MATHCALLX (fmaximum_num,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
392
393/* Return minimum numeric value from X and Y. */
394__MATHCALLX (fminimum_num,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
395
396/* Return value with maximum magnitude. */
397__MATHCALLX (fmaximum_mag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
398
399/* Return value with minimum magnitude. */
400__MATHCALLX (fminimum_mag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
401
402/* Return numeric value with maximum magnitude. */
403__MATHCALLX (fmaximum_mag_num,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
404
405/* Return numeric value with minimum magnitude. */
406__MATHCALLX (fminimum_mag_num,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
407#endif
408
409#if __GLIBC_USE (IEC_60559_EXT) || __MATH_DECLARING_FLOATN
410/* Total order operation. */
411__MATHDECL_1 (int, totalorder,, (const _Mdouble_ *__x,
412 const _Mdouble_ *__y))
413 __attribute_pure__;
414
415/* Total order operation on absolute values. */
416__MATHDECL_1 (int, totalordermag,, (const _Mdouble_ *__x,
417 const _Mdouble_ *__y))
418 __attribute_pure__;
419
420/* Get NaN payload. */
421__MATHCALL (getpayload,, (const _Mdouble_ *__x));
422
423/* Set quiet NaN payload. */
424__MATHDECL_1 (int, setpayload,, (_Mdouble_ *__x, _Mdouble_ __payload));
425
426/* Set signaling NaN payload. */
427__MATHDECL_1 (int, setpayloadsig,, (_Mdouble_ *__x, _Mdouble_ __payload));
428#endif
429
430#if (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
431 && __MATH_DECLARING_DOUBLE \
432 && !defined __USE_XOPEN2K8)) \
433 && !__MATH_DECLARING_FLOATN
434/* Return X times (2 to the Nth power). */
435__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
436#endif
437

source code of include/x86_64-linux-gnu/bits/mathcalls.h