OSDN Git Service

Replace FSF snail mail address with URLs
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / common / bits / mathcalls.h
1 /* Prototype declarations for math functions; helper file for <math.h>.
2    Copyright (C) 1996-2002, 2003, 2006 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 /* __MATHCALLX(type,function,[suffix],args,attrib) and
51  * __MATHCALLI(type,function,[suffix],args) include libm_hidden_proto
52  * (for "double" versions only, xxxf and xxxl do not get this treatment).
53  *
54  * __MATHDECL(type,function,[suffix],args) does not.
55  * __MATHCALL(function,[suffix],args) also does not
56  * (it is just a shortcut to __MATHDECL(_Mdouble_,function,[suffix],args)).
57  *
58  * __MATHDECL_PRIV(type,function,[suffix],args,attrib)
59  * includes libm_hidden_proto (always) and declares __foo, not foo.
60  */
61
62
63 /* Trigonometric functions.  */
64
65 _Mdouble_BEGIN_NAMESPACE
66 /* Arc cosine of X.  */
67 __MATHCALLI (acos,, (_Mdouble_ __x))
68 /* Arc sine of X.  */
69 __MATHCALLI (asin,, (_Mdouble_ __x))
70 /* Arc tangent of X.  */
71 __MATHCALLI (atan,, (_Mdouble_ __x))
72 /* Arc tangent of Y/X.  */
73 __MATHCALLI (atan2,, (_Mdouble_ __y, _Mdouble_ __x))
74
75 /* Cosine of X.  */
76 __MATHCALLI (cos,, (_Mdouble_ __x))
77 /* Sine of X.  */
78 __MATHCALLI (sin,, (_Mdouble_ __x))
79 /* Tangent of X.  */
80 __MATHCALLI (tan,, (_Mdouble_ __x))
81
82 /* Hyperbolic functions.  */
83
84 /* Hyperbolic cosine of X.  */
85 __MATHCALLI (cosh,, (_Mdouble_ __x))
86 /* Hyperbolic sine of X.  */
87 __MATHCALLI (sinh,, (_Mdouble_ __x))
88 /* Hyperbolic tangent of X.  */
89 __MATHCALLI (tanh,, (_Mdouble_ __x))
90 _Mdouble_END_NAMESPACE
91
92 #if defined __USE_GNU
93 /* Cosine and sine of X.  */
94 __MATHDECL (void,sincos,,
95             (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx))
96 #endif
97
98 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
99 __BEGIN_NAMESPACE_C99
100 /* Hyperbolic arc cosine of X.  */
101 __MATHCALLI (acosh,, (_Mdouble_ __x))
102 /* Hyperbolic arc sine of X.  */
103 __MATHCALLI (asinh,, (_Mdouble_ __x))
104 /* Hyperbolic arc tangent of X.  */
105 __MATHCALLI (atanh,, (_Mdouble_ __x))
106 __END_NAMESPACE_C99
107 #endif
108
109 /* Exponential and logarithmic functions.  */
110
111 _Mdouble_BEGIN_NAMESPACE
112 /* Exponential function of X.  */
113 __MATHCALLI (exp,, (_Mdouble_ __x))
114
115 /* Break VALUE into a normalized fraction and an integral power of 2.  */
116 __MATHCALLI (frexp,, (_Mdouble_ __x, int *__exponent))
117
118 /* X times (two to the EXP power).  */
119 __MATHCALLI (ldexp,, (_Mdouble_ __x, int __exponent))
120
121 /* Natural logarithm of X.  */
122 __MATHCALLI (log,, (_Mdouble_ __x))
123
124 /* Base-ten logarithm of X.  */
125 __MATHCALLI (log10,, (_Mdouble_ __x))
126
127 /* Break VALUE into integral and fractional parts.  */
128 __MATHCALLI (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr))
129 _Mdouble_END_NAMESPACE
130
131 #if 0 /*def __USE_GNU*/
132 /* A function missing in all standards: compute exponent to base ten.  */
133 __MATHCALL (exp10,, (_Mdouble_ __x))
134 /* Another name occasionally used.  */
135 __MATHCALL (pow10,, (_Mdouble_ __x))
136 #endif
137
138 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
139 __BEGIN_NAMESPACE_C99
140 /* Return exp(X) - 1.  */
141 __MATHCALLI (expm1,, (_Mdouble_ __x))
142
143 /* Return log(1 + X).  */
144 __MATHCALLI (log1p,, (_Mdouble_ __x))
145
146 /* Return the base 2 signed integral exponent of X.  */
147 __MATHCALLI (logb,, (_Mdouble_ __x))
148 __END_NAMESPACE_C99
149 #endif
150
151 #ifdef __USE_ISOC99
152 __BEGIN_NAMESPACE_C99
153 /* Compute base-2 exponential of X.  */
154 __MATHCALLI (exp2,, (_Mdouble_ __x))
155
156 /* Compute base-2 logarithm of X.  */
157 __MATHCALLI (log2,, (_Mdouble_ __x))
158 __END_NAMESPACE_C99
159 #endif
160
161
162 /* Power functions.  */
163
164 _Mdouble_BEGIN_NAMESPACE
165 /* Return X to the Y power.  */
166 __MATHCALLI (pow,, (_Mdouble_ __x, _Mdouble_ __y))
167
168 /* Return the square root of X.  */
169 __MATHCALLI (sqrt,, (_Mdouble_ __x))
170 _Mdouble_END_NAMESPACE
171
172 #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
173 __BEGIN_NAMESPACE_C99
174 /* Return `sqrt(X*X + Y*Y)'.  */
175 __MATHCALLI (hypot,, (_Mdouble_ __x, _Mdouble_ __y))
176 __END_NAMESPACE_C99
177 #endif
178
179 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
180 __BEGIN_NAMESPACE_C99
181 /* Return the cube root of X.  */
182 __MATHCALLI (cbrt,, (_Mdouble_ __x))
183 __END_NAMESPACE_C99
184 #endif
185
186
187 /* Nearest integer, absolute value, and remainder functions.  */
188
189 _Mdouble_BEGIN_NAMESPACE
190 /* Smallest integral value not less than X.  */
191 __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__))
192
193 /* Absolute value of X.  */
194 __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__))
195
196 /* Largest integer not greater than X.  */
197 __MATHCALLX (floor,, (_Mdouble_ __x), (__const__))
198
199 /* Floating-point modulo remainder of X/Y.  */
200 __MATHCALLI (fmod,, (_Mdouble_ __x, _Mdouble_ __y))
201
202
203 /* Return 0 if VALUE is finite or NaN, +1 if it
204    is +Infinity, -1 if it is -Infinity.  */
205 __MATHDECL_PRIV (int,isinf,, (_Mdouble_ __value), (__const__))
206
207 /* Return nonzero if VALUE is finite and not NaN.  */
208 __MATHDECL_PRIV (int,finite,, (_Mdouble_ __value), (__const__))
209 _Mdouble_END_NAMESPACE
210
211 #ifdef __USE_MISC
212 #if 0
213 /* Return 0 if VALUE is finite or NaN, +1 if it
214    is +Infinity, -1 if it is -Infinity.  */
215 __MATHDECL_PRIV (int,isinf,, (_Mdouble_ __value), (__const__))
216
217 /* Return nonzero if VALUE is finite and not NaN.  */
218 __MATHDECL_PRIV (int,finite,, (_Mdouble_ __value), (__const__))
219 #endif
220 /* Return the remainder of X/Y.  */
221 __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y))
222
223
224 /* Return the fractional part of X after dividing out `ilogb (X)'.  */
225 __MATHCALLI (significand,, (_Mdouble_ __x))
226 #endif /* Use misc.  */
227
228 #if defined __USE_MISC || defined __USE_ISOC99
229 __BEGIN_NAMESPACE_C99
230 /* Return X with its signed changed to Y's.  */
231 __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__))
232 __END_NAMESPACE_C99
233 #endif
234
235 #ifdef __USE_ISOC99
236 __BEGIN_NAMESPACE_C99
237 /* Return representation of NaN for double type.  */
238 __MATHCALLX (nan,, (__const char *__tagb), (__const__))
239 __END_NAMESPACE_C99
240 #endif
241
242 #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
243 /* Return nonzero if VALUE is not a number.  */
244 __BEGIN_NAMESPACE_C99
245 __MATHDECL_PRIV (int,isnan,, (_Mdouble_ __value), (__const__))
246 __END_NAMESPACE_C99
247 #endif
248
249 #if defined __USE_MISC || defined __USE_XOPEN
250 # ifdef __DO_XSI_MATH__
251 /* Bessel functions.  */
252 __MATHCALL (j0,, (_Mdouble_))
253 __MATHCALL (j1,, (_Mdouble_))
254 __MATHCALL (jn,, (int, _Mdouble_))
255 __MATHCALL (y0,, (_Mdouble_))
256 __MATHCALL (y1,, (_Mdouble_))
257 __MATHCALL (yn,, (int, _Mdouble_))
258 # endif
259 #endif
260
261
262 #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
263 __BEGIN_NAMESPACE_C99
264 /* Error and gamma functions.  */
265 __MATHCALLI (erf,, (_Mdouble_))
266 __MATHCALLI (erfc,, (_Mdouble_))
267 __MATHCALLI (lgamma,, (_Mdouble_))
268 __END_NAMESPACE_C99
269 #endif
270
271 #ifdef __USE_ISOC99
272 __BEGIN_NAMESPACE_C99
273 /* True gamma function.  */
274 __MATHCALLI (tgamma,, (_Mdouble_))
275 __END_NAMESPACE_C99
276 #endif
277
278 #if defined __USE_MISC || defined __USE_XOPEN
279 /* Obsolete alias for `lgamma'.  */
280 __MATHCALLI (gamma,, (_Mdouble_))
281 #endif
282
283 #ifdef __USE_MISC
284 /* Reentrant version of lgamma.  This function uses the global variable
285    `signgam'.  The reentrant version instead takes a pointer and stores
286    the value through it.  */
287 __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp))
288 /* __MATHCALLI does not work here, probably due to ,_r, */
289 libm_hidden_proto(lgamma_r)
290 #endif
291
292
293 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
294 __BEGIN_NAMESPACE_C99
295 /* Return the integer nearest X in the direction of the
296    prevailing rounding mode.  */
297 __MATHCALLI (rint,, (_Mdouble_ __x))
298
299 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
300 __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__))
301 # if defined __USE_ISOC99 && !defined __LDBL_COMPAT
302 __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__))
303 # endif
304
305 /* Return the remainder of integer divison X / Y with infinite precision.  */
306 __MATHCALLI (remainder,, (_Mdouble_ __x, _Mdouble_ __y))
307
308 # if defined __USE_MISC || defined __USE_ISOC99
309 /* Return X times (2 to the Nth power).  */
310 __MATHCALLI (scalbn,, (_Mdouble_ __x, int __n))
311 # endif
312
313 /* Return the binary exponent of X, which must be nonzero.  */
314 __MATHDECLI (int,ilogb,, (_Mdouble_ __x))
315 #endif
316
317 #ifdef __USE_ISOC99
318 /* Return X times (2 to the Nth power).  */
319 __MATHCALLI (scalbln,, (_Mdouble_ __x, long int __n))
320
321 /* Round X to integral value in floating-point format using current
322    rounding direction, but do not raise inexact exception.  */
323 __MATHCALLI (nearbyint,, (_Mdouble_ __x))
324
325 /* Round X to nearest integral value, rounding halfway cases away from
326    zero.  */
327 __MATHCALLX (round,, (_Mdouble_ __x), (__const__))
328
329 /* Round X to the integral value in floating-point format nearest but
330    not larger in magnitude.  */
331 __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__))
332
333 /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
334    and magnitude congruent `mod 2^n' to the magnitude of the integral
335    quotient x/y, with n >= 3.  */
336 __MATHCALLI (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo))
337
338
339 /* Conversion functions.  */
340
341 /* Round X to nearest integral value according to current rounding
342    direction.  */
343 __MATHDECLI (long int,lrint,, (_Mdouble_ __x))
344 __MATHDECLI (long long int,llrint,, (_Mdouble_ __x))
345
346 /* Round X to nearest integral value, rounding halfway cases away from
347    zero.  */
348 __MATHDECLI (long int,lround,, (_Mdouble_ __x))
349 __MATHDECLI (long long int,llround,, (_Mdouble_ __x))
350
351
352 /* Return positive difference between X and Y.  */
353 __MATHCALLI (fdim,, (_Mdouble_ __x, _Mdouble_ __y))
354
355 /* Return maximum numeric value from X and Y.  */
356 __MATHCALLI (fmax,, (_Mdouble_ __x, _Mdouble_ __y))
357
358 /* Return minimum numeric value from X and Y.  */
359 __MATHCALLI (fmin,, (_Mdouble_ __x, _Mdouble_ __y))
360
361
362 /* Classify given number.  */
363 __MATHDECL_PRIV (int, fpclassify,, (_Mdouble_ __value), (__const__))
364
365 /* Test for negative number.  */
366 __MATHDECL_PRIV (int, signbit,, (_Mdouble_ __value), (__const__))
367
368
369 /* Multiply-add function computed as a ternary operation.  */
370 __MATHCALLI (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z))
371 #endif /* Use ISO C99.  */
372
373 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
374 __END_NAMESPACE_C99
375 #endif
376
377 #if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) \
378         && defined __UCLIBC_SUSV3_LEGACY__
379 /* Return X times (2 to the Nth power).  */
380 __MATHCALLI (scalb,, (_Mdouble_ __x, _Mdouble_ __n))
381 #endif