]> git.ipfire.org Git - thirdparty/glibc.git/blame - math/bits/mathcalls.h
Update.
[thirdparty/glibc.git] / math / bits / mathcalls.h
CommitLineData
f7eac6eb 1/* Prototype declarations for math functions; helper file for <math.h>.
4bbac92a 2 Copyright (C) 1996, 1997, 1998 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
af6f3906 41 both a `NAME' and a `NAMEf' that takes `float' arguments.
4bbac92a 42
af6f3906
UD
43 Note that there must be no whitespace before the argument passed for
44 NAME, to make token pasting work with -traditional. */
f7eac6eb
RM
45
46#ifndef _MATH_H
5107cf1d 47 #error "Never include <bits/mathcalls.h> directly; include <math.h> instead."
f7eac6eb
RM
48#endif
49
50
51/* Trigonometric functions. */
52
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 (cos,, (_Mdouble_ __x));
64/* Sine of X. */
65__MATHCALL (sin,, (_Mdouble_ __x));
66/* Tangent of X. */
67__MATHCALL (tan,, (_Mdouble_ __x));
68
7799b7b3
UD
69#ifdef __USE_GNU
70/* Cosine and sine of X. */
af6f3906 71__MATHDECL (void,sincos,,
7799b7b3
UD
72 (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
73#endif
f7eac6eb
RM
74
75/* Hyperbolic functions. */
76
77/* Hyperbolic cosine of X. */
78__MATHCALL (cosh,, (_Mdouble_ __x));
79/* Hyperbolic sine of X. */
80__MATHCALL (sinh,, (_Mdouble_ __x));
81/* Hyperbolic tangent of X. */
82__MATHCALL (tanh,, (_Mdouble_ __x));
83
377a515b 84#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
f7eac6eb
RM
85/* Hyperbolic arc cosine of X. */
86__MATHCALL (acosh,, (_Mdouble_ __x));
87/* Hyperbolic arc sine of X. */
88__MATHCALL (asinh,, (_Mdouble_ __x));
89/* Hyperbolic arc tangent of X. */
90__MATHCALL (atanh,, (_Mdouble_ __x));
91#endif
92
93/* Exponential and logarithmic functions. */
94
6d52618b 95/* Exponential function of X. */
f7eac6eb
RM
96__MATHCALL (exp,, (_Mdouble_ __x));
97
4bbac92a
UD
98#ifdef __USE_GNU
99/* A function missing in all standards: compute exponent to base ten. */
100__MATHCALL (exp10,, (_Mdouble_ __x));
101/* Another name occasionally used. */
102__MATHCALL (pow10,, (_Mdouble_ __x));
103#endif
104
f7eac6eb 105/* Break VALUE into a normalized fraction and an integral power of 2. */
afd4eb37 106__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
f7eac6eb
RM
107
108/* X times (two to the EXP power). */
afd4eb37 109__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
f7eac6eb
RM
110
111/* Natural logarithm of X. */
112__MATHCALL (log,, (_Mdouble_ __x));
113
114/* Base-ten logarithm of X. */
115__MATHCALL (log10,, (_Mdouble_ __x));
116
377a515b
UD
117/* Break VALUE into integral and fractional parts. */
118__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
119
120#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
f7eac6eb
RM
121/* Return exp(X) - 1. */
122__MATHCALL (expm1,, (_Mdouble_ __x));
123
124/* Return log(1 + X). */
125__MATHCALL (log1p,, (_Mdouble_ __x));
2c6fe0bd
UD
126
127/* Return the base 2 signed integral exponent of X. */
128__MATHCALL (logb,, (_Mdouble_ __x));
f7eac6eb
RM
129#endif
130
377a515b
UD
131#ifdef __USE_ISOC9X
132/* Compute base-2 exponential of X. */
133__MATHCALL (exp2,, (_Mdouble_ __x));
134
135/* Compute base-2 logarithm of X. */
136__MATHCALL (log2,, (_Mdouble_ __x));
137#endif
f7eac6eb
RM
138
139
140/* Power functions. */
141
142/* Return X to the Y power. */
143__MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
144
145/* Return the square root of X. */
146__MATHCALL (sqrt,, (_Mdouble_ __x));
147
e918a7fe 148#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC9X
377a515b
UD
149/* Return `sqrt(X*X + Y*Y)'. */
150__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
e918a7fe 151#endif
377a515b 152
e918a7fe 153#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
f7eac6eb
RM
154/* Return the cube root of X. */
155__MATHCALL (cbrt,, (_Mdouble_ __x));
156#endif
157
158
159/* Nearest integer, absolute value, and remainder functions. */
160
161/* Smallest integral value not less than X. */
162__MATHCALL (ceil,, (_Mdouble_ __x));
163
164/* Absolute value of X. */
3e5f5557 165__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
f7eac6eb
RM
166
167/* Largest integer not greater than X. */
168__MATHCALL (floor,, (_Mdouble_ __x));
169
170/* Floating-point modulo remainder of X/Y. */
171__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
172
173
bfce746a
UD
174/* Return 0 if VALUE is finite or NaN, +1 if it
175 is +Infinity, -1 if it is -Infinity. */
176__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
177
f7eac6eb 178#ifdef __USE_MISC
f7eac6eb
RM
179/* Return 0 if VALUE is finite or NaN, +1 if it
180 is +Infinity, -1 if it is -Infinity. */
bfce746a 181__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
f7eac6eb 182
f7eac6eb 183/* Return nonzero if VALUE is finite and not NaN. */
3e5f5557 184__MATHDECLX (int,finite,, (_Mdouble_ __value), (__const__));
f7eac6eb
RM
185
186/* Deal with an infinite or NaN result.
187 If ERROR is ERANGE, result is +Inf;
188 if ERROR is - ERANGE, result is -Inf;
189 otherwise result is NaN.
190 This will set `errno' to either ERANGE or EDOM,
191 and may return an infinity or NaN, or may do something else. */
3e5f5557 192__MATHCALLX (infnan,, (int __error), (__const__));
f7eac6eb 193
f7eac6eb
RM
194/* Return the remainder of X/Y. */
195__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
196
f7eac6eb 197
2c6fe0bd
UD
198/* Return the fractional part of X after dividing out `ilogb (X)'. */
199__MATHCALL (significand,, (_Mdouble_ __x));
200#endif /* Use misc. */
f7eac6eb 201
377a515b
UD
202#if defined __USE_MISC || defined __USE_ISOC9X
203/* Return X with its signed changed to Y's. */
3e5f5557 204__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
377a515b
UD
205#endif
206
207#ifdef __USE_ISOC9X
208/* Return representation of NaN for double type. */
3e5f5557 209__MATHCALLX (nan,, (__const char *__tagb), (__const__));
377a515b 210#endif
2c6fe0bd 211
2c6fe0bd 212
377a515b 213#if defined __USE_MISC || defined __USE_XOPEN
2c6fe0bd 214/* Return nonzero if VALUE is not a number. */
3e5f5557 215__MATHDECLX (int,isnan,, (_Mdouble_ __value), (__const__));
f7eac6eb 216
377a515b
UD
217/* Bessel functions. */
218__MATHCALL (j0,, (_Mdouble_));
219__MATHCALL (j1,, (_Mdouble_));
220__MATHCALL (jn,, (int, _Mdouble_));
221__MATHCALL (y0,, (_Mdouble_));
222__MATHCALL (y1,, (_Mdouble_));
223__MATHCALL (yn,, (int, _Mdouble_));
224#endif
f7eac6eb
RM
225
226
377a515b 227#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC9X
f7eac6eb
RM
228/* Error, gamma, and Bessel functions. */
229__MATHCALL (erf,, (_Mdouble_));
230__MATHCALL (erfc,, (_Mdouble_));
f7eac6eb 231__MATHCALL (lgamma,, (_Mdouble_));
e852e889
UD
232__MATHCALL (tgamma,, (_Mdouble_));
233#endif
234
235#if defined __USE_MISC || defined __USE_XOPEN
236__MATHCALL (gamma,, (_Mdouble_));
d705269e 237#endif
f7eac6eb 238
19361cb7 239#ifdef __USE_MISC
f7eac6eb
RM
240/* Reentrant versions of gamma and lgamma. Those functions use the global
241 variable `signgam'. The reentrant versions instead take a pointer and
242 store the value through it. */
243__MATHCALL (gamma,_r, (_Mdouble_, int *));
244__MATHCALL (lgamma,_r, (_Mdouble_, int *));
245#endif
246
2c6fe0bd 247
377a515b 248#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
2c6fe0bd
UD
249/* Return the integer nearest X in the direction of the
250 prevailing rounding mode. */
251__MATHCALL (rint,, (_Mdouble_ __x));
252
2c6fe0bd 253/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
3e5f5557 254__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
bfce746a 255# ifdef __USE_ISOC9X
dfd2257a 256__MATHCALLX (nextafterx,, (_Mdouble_ __x, long double __y), (__const__));
bfce746a 257# endif
2c6fe0bd
UD
258
259/* Return the remainder of integer divison X / Y with infinite precision. */
260__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
2c6fe0bd 261
bfce746a 262#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
377a515b
UD
263/* Return X times (2 to the Nth power). */
264__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
bfce746a 265#endif
d705269e
UD
266
267/* Return X times (2 to the Nth power). */
dfd2257a 268__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
d705269e
UD
269
270/* Return the binary exponent of X, which must be nonzero. */
271__MATHDECL (int,ilogb,, (_Mdouble_ __x));
377a515b
UD
272#endif
273
274#ifdef __USE_ISOC9X
dfd2257a
UD
275/* Return X times (2 to the Nth power). */
276__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n));
277
377a515b
UD
278/* Round X to integral valuein floating-point format using current
279 rounding direction, but do not raise inexact exception. */
280__MATHCALL (nearbyint,, (_Mdouble_ __x));
281
282/* Round X to nearest integral value, rounding halfway cases away from
283 zero. */
284__MATHCALL (round,, (_Mdouble_ __x));
285
286/* Round X to the integral value in floating-point format nearest but
287 not larger in magnitude. */
3e5f5557 288__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
377a515b
UD
289
290/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
291 and magnitude congruent `mod 2^n' to the magnitude of the integral
292 quotient x/y, with n >= 3. */
293__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
294
295
dfd2257a
UD
296/* Conversion functions. */
297
298/* Round X to nearest integral value according to current rounding
299 direction. */
af6f3906
UD
300__MATHDECL (long int,lrint,, (_Mdouble_ __x));
301__MATHDECL (long long int,llrint,, (_Mdouble_ __x));
dfd2257a
UD
302
303/* Round X to nearest integral value, rounding halfway cases away from
304 zero. */
af6f3906
UD
305__MATHDECL (long int,lround,, (_Mdouble_ __x));
306__MATHDECL (long long int,llround,, (_Mdouble_ __x));
dfd2257a
UD
307
308
377a515b
UD
309/* Return positive difference between X and Y. */
310__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
311
4cca6b86 312/* Return maximum numeric value from X and Y. */
377a515b
UD
313__MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y));
314
4cca6b86 315/* Return minimum numeric value from X and Y. */
377a515b
UD
316__MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y));
317
318
319/* Classify given number. */
3e5f5557
UD
320__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
321 __attribute__ ((__const__));
377a515b
UD
322
323/* Test for negative number. */
3e5f5557
UD
324__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
325 __attribute__ ((__const__));
dfd2257a
UD
326
327
328/* Multiply-add function computed as a ternary operation. */
329__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
377a515b 330#endif /* Use ISO C 9X. */