1 /* Copyright (C) 1991 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * ANSI Standard: 4.5 MATHEMATICS <math.h>
32 /* Get HUGE_VAL (returned on overflow) from <float.h>. */
33 #define __need_HUGE_VAL
39 /* The `const' keyword tells GCC that a function's return value is
40 based solely on its arguments, and there are no side-effects. */
41 #define __CONSTVALUE __const
45 #endif /* __CONSTVALUE not defined. */
48 /* Trigonometric functions. */
50 /* Arc cosine of X. */
51 extern __CONSTVALUE double EXFUN(acos, (double __x));
53 extern __CONSTVALUE double EXFUN(asin, (double __x));
54 /* Arc tangent of X. */
55 extern __CONSTVALUE double EXFUN(atan, (double __x));
56 /* Arc tangent of Y/X. */
57 extern __CONSTVALUE double EXFUN(atan2, (double __y, double __x));
60 extern __CONSTVALUE double EXFUN(cos, (double __x));
62 extern __CONSTVALUE double EXFUN(sin, (double __x));
64 extern __CONSTVALUE double EXFUN(tan, (double __x));
67 /* Hyperbolic functions. */
69 /* Hyperbolic cosine of X. */
70 extern __CONSTVALUE double EXFUN(cosh, (double __x));
71 /* Hyperbolic sine of X. */
72 extern __CONSTVALUE double EXFUN(sinh, (double __x));
73 /* Hyperbolic tangent of X. */
74 extern __CONSTVALUE double EXFUN(tanh, (double __x));
77 /* Hyperbolic arc cosine of X. */
78 extern __CONSTVALUE double EXFUN(acosh, (double __x));
79 /* Hyperbolic arc sine of X. */
80 extern __CONSTVALUE double EXFUN(asinh, (double __x));
81 /* Hyperbolic arc tangent of X. */
82 extern __CONSTVALUE double EXFUN(atanh, (double __x));
85 /* Exponential and logarithmic functions. */
87 /* Exponentional function of X. */
88 extern __CONSTVALUE double EXFUN(exp, (double __x));
90 /* Break VALUE into a normalized fraction and an integral power of 2. */
91 extern double EXFUN(frexp, (double __value, int *__exp));
93 /* X times (two to the EXP power). */
94 extern __CONSTVALUE double EXFUN(ldexp, (double __x, int __exp));
96 /* Natural logarithm of X. */
97 extern __CONSTVALUE double EXFUN(log, (double __x));
99 /* Base-ten logarithm of X. */
100 extern __CONSTVALUE double EXFUN(log10, (double __x));
103 /* Return exp(X) - 1. */
104 extern __CONSTVALUE double EXFUN(expm1, (double __x));
106 /* Return log(1 + X). */
107 extern __CONSTVALUE double EXFUN(log1p, (double __x));
110 /* Break VALUE into integral and fractional parts. */
111 extern double EXFUN(modf, (double __value, double *__iptr));
114 /* Power functions. */
116 /* Return X to the Y power. */
117 extern __CONSTVALUE double EXFUN(pow, (double __x, double __y));
119 /* Return the square root of X. */
120 extern __CONSTVALUE double EXFUN(sqrt, (double __x));
123 /* Return the cube root of X. */
124 extern __CONSTVALUE double EXFUN(cbrt, (double __x));
128 /* Nearest integer, absolute value, and remainder functions. */
130 /* Smallest integral value not less than X. */
131 extern __CONSTVALUE double EXFUN(ceil, (double __x));
133 /* Absolute value of X. */
134 extern __CONSTVALUE double EXFUN(fabs, (double __x));
136 /* Largest integer not greater than X. */
137 extern __CONSTVALUE double EXFUN(floor, (double __x));
139 /* Floating-point modulo remainder of X/Y. */
140 extern __CONSTVALUE double EXFUN(fmod, (double __x, double __y));
143 /* Return 0 if VALUE is finite or NaN, +1 if it
144 is +Infinity, -1 if it is -Infinity. */
145 extern __CONSTVALUE int EXFUN(__isinf, (double __value));
147 /* Return nonzero if VALUE is not a number. */
148 extern __CONSTVALUE int EXFUN(__isnan, (double __value));
150 /* Return nonzero if VALUE is finite (or NaN). */
151 extern __CONSTVALUE int EXFUN(__finite, (double __value));
153 #define __finite(value) (!__isinf(value))
156 /* Deal with an infinite or NaN result.
157 If ERROR is ERANGE, result is +Inf;
158 if ERROR is - ERANGE, result is -Inf;
159 otherwise result is NaN.
160 This will set `errno' to either ERANGE or EDOM,
161 and may return an infinity or NaN, or may do something else. */
162 extern double EXFUN(__infnan, (int __error));
164 /* Return X with its signed changed to Y's. */
165 extern __CONSTVALUE double EXFUN(__copysign, (double __x, double __y));
167 /* Return X times (2 to the Nth power). */
168 extern __CONSTVALUE double EXFUN(__scalb, (double __x, int __n));
170 /* Return the remainder of X/Y. */
171 extern __CONSTVALUE double EXFUN(__drem, (double __x, double __y));
173 /* Return the base 2 signed integral exponent of X. */
174 extern __CONSTVALUE double EXFUN(__logb, (double __x));
178 /* Return the integer nearest X in the direction of the
179 prevailing rounding mode. */
180 extern __CONSTVALUE double EXFUN(rint, (double __x));
182 /* Return `sqrt(X*X + Y*Y)'. */
183 extern __CONSTVALUE double EXFUN(hypot, (double __x, double __y));
189 /* Return `sqrt(X*X + Y*Y)'. */
190 extern __CONSTVALUE double EXFUN(cabs, (struct __complex));
192 extern __CONSTVALUE int EXFUN(isinf, (double __value));
193 extern __CONSTVALUE int EXFUN(isnan, (double __value));
194 extern __CONSTVALUE int EXFUN(finite, (double __value));
195 extern __CONSTVALUE double EXFUN(infnan, (int __error));
196 extern __CONSTVALUE double EXFUN(copysign, (double __x, double __y));
197 extern __CONSTVALUE double EXFUN(scalb, (double __x, int __n));
198 extern __CONSTVALUE double EXFUN(drem, (double __x, double __y));
199 extern __CONSTVALUE double EXFUN(logb, (double __x));
202 #define isinf(value) __isinf(value)
203 #define isnan(value) __isnan(value)
204 #define infnan(error) __infnan(error)
205 #define finite(value) __finite(value)
206 #define copysign(x, y) __copysign((x), (y))
207 #define scalb(x, n) __scalb((x), (n))
208 #define drem(x, y) __drem((x), (y))
209 #define logb(x) __logb(x)
210 #endif /* Optimizing. */
212 #endif /* Use misc. */
216 /* The "Future Library Directions" section of the
217 ANSI Standard reserves these as `float' and
218 `long double' versions of the above functions. */
220 extern __CONSTVALUE float EXFUN(acosf, (float __x));
221 extern __CONSTVALUE float EXFUN(asinf, (float __x));
222 extern __CONSTVALUE float EXFUN(atanf, (float __x));
223 extern __CONSTVALUE float EXFUN(atan2f, (float __y, float __x));
224 extern __CONSTVALUE float EXFUN(cosf, (float __x));
225 extern __CONSTVALUE float EXFUN(sinf, (float __x));
226 extern __CONSTVALUE float EXFUN(tanf, (float __x));
227 extern __CONSTVALUE float EXFUN(coshf, (float __x));
228 extern __CONSTVALUE float EXFUN(sinhf, (float __x));
229 extern __CONSTVALUE float EXFUN(tanhf, (float __x));
230 extern __CONSTVALUE float EXFUN(expf, (float __x));
231 extern float EXFUN(frexpf, (float __value, int *__exp));
232 extern __CONSTVALUE float EXFUN(ldexpf, (float __x, int __exp));
233 extern __CONSTVALUE float EXFUN(logf, (float __x));
234 extern __CONSTVALUE float EXFUN(log10f, (float __x));
235 extern float EXFUN(modff, (float __value, float *__iptr));
236 extern __CONSTVALUE float EXFUN(powf, (float __x, float __y));
237 extern __CONSTVALUE float EXFUN(sqrtf, (float __x));
238 extern __CONSTVALUE float EXFUN(ceilf, (float __x));
239 extern __CONSTVALUE float EXFUN(fabsf, (float __x));
240 extern __CONSTVALUE float EXFUN(floorf, (float __x));
241 extern __CONSTVALUE float EXFUN(fmodf, (float __x, float __y));
243 extern __CONSTVALUE LONG_DOUBLE EXFUN(acosl, (LONG_DOUBLE __x));
244 extern __CONSTVALUE LONG_DOUBLE EXFUN(asinl, (LONG_DOUBLE __x));
245 extern __CONSTVALUE LONG_DOUBLE EXFUN(atanl, (LONG_DOUBLE __x));
246 extern __CONSTVALUE LONG_DOUBLE EXFUN(atan2l,
247 (LONG_DOUBLE __y, LONG_DOUBLE __x));
248 extern __CONSTVALUE LONG_DOUBLE EXFUN(cosl, (LONG_DOUBLE __x));
249 extern __CONSTVALUE LONG_DOUBLE EXFUN(sinl, (LONG_DOUBLE __x));
250 extern __CONSTVALUE LONG_DOUBLE EXFUN(tanl, (LONG_DOUBLE __x));
251 extern __CONSTVALUE LONG_DOUBLE EXFUN(coshl, (LONG_DOUBLE __x));
252 extern __CONSTVALUE LONG_DOUBLE EXFUN(sinhl, (LONG_DOUBLE __x));
253 extern __CONSTVALUE LONG_DOUBLE EXFUN(tanhl, (LONG_DOUBLE __x));
254 extern __CONSTVALUE LONG_DOUBLE EXFUN(expl, (LONG_DOUBLE __x));
255 extern LONG_DOUBLE EXFUN(frexpl, (LONG_DOUBLE __value, int *__exp));
256 extern __CONSTVALUE LONG_DOUBLE EXFUN(ldexpl, (LONG_DOUBLE __x, int __exp));
257 extern __CONSTVALUE LONG_DOUBLE EXFUN(logl, (LONG_DOUBLE __x));
258 extern __CONSTVALUE LONG_DOUBLE EXFUN(log10l, (LONG_DOUBLE __x));
259 extern LONG_DOUBLE EXFUN(modfl, (LONG_DOUBLE __value, LONG_DOUBLE *__ip));
260 extern __CONSTVALUE LONG_DOUBLE EXFUN(powl,
261 (LONG_DOUBLE __x, LONG_DOUBLE __y));
262 extern __CONSTVALUE LONG_DOUBLE EXFUN(sqrtl, (LONG_DOUBLE __x));
263 extern __CONSTVALUE LONG_DOUBLE EXFUN(ceill, (LONG_DOUBLE __x));
264 extern __CONSTVALUE LONG_DOUBLE EXFUN(fabsl, (LONG_DOUBLE __x));
265 extern __CONSTVALUE LONG_DOUBLE EXFUN(floorl, (LONG_DOUBLE __x));
266 extern __CONSTVALUE LONG_DOUBLE EXFUN(fmodl,
267 (LONG_DOUBLE __x, LONG_DOUBLE __y));
270 /* Get machine-dependent inline versions (if there are any). */