1 /* Copyright (C) 1991, 1992 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 machine-dependent HUGE_VAL value (returned on overflow). */
35 /* Get machine-dependent NAN value (returned for some domain errors). */
43 /* The `const' keyword tells GCC that a function's return value is
44 based solely on its arguments, and there are no side-effects. */
45 #define __CONSTVALUE __const
49 #endif /* __CONSTVALUE not defined. */
52 /* Trigonometric functions. */
54 /* Arc cosine of X. */
55 extern __CONSTVALUE double EXFUN(acos, (double __x));
57 extern __CONSTVALUE double EXFUN(asin, (double __x));
58 /* Arc tangent of X. */
59 extern __CONSTVALUE double EXFUN(atan, (double __x));
60 /* Arc tangent of Y/X. */
61 extern __CONSTVALUE double EXFUN(atan2, (double __y, double __x));
64 extern __CONSTVALUE double EXFUN(cos, (double __x));
66 extern __CONSTVALUE double EXFUN(sin, (double __x));
68 extern __CONSTVALUE double EXFUN(tan, (double __x));
71 /* Hyperbolic functions. */
73 /* Hyperbolic cosine of X. */
74 extern __CONSTVALUE double EXFUN(cosh, (double __x));
75 /* Hyperbolic sine of X. */
76 extern __CONSTVALUE double EXFUN(sinh, (double __x));
77 /* Hyperbolic tangent of X. */
78 extern __CONSTVALUE double EXFUN(tanh, (double __x));
81 /* Hyperbolic arc cosine of X. */
82 extern __CONSTVALUE double EXFUN(acosh, (double __x));
83 /* Hyperbolic arc sine of X. */
84 extern __CONSTVALUE double EXFUN(asinh, (double __x));
85 /* Hyperbolic arc tangent of X. */
86 extern __CONSTVALUE double EXFUN(atanh, (double __x));
89 /* Exponential and logarithmic functions. */
91 /* Exponentional function of X. */
92 extern __CONSTVALUE double EXFUN(exp, (double __x));
94 /* Break VALUE into a normalized fraction and an integral power of 2. */
95 extern double EXFUN(frexp, (double __value, int *__exp));
97 /* X times (two to the EXP power). */
98 extern __CONSTVALUE double EXFUN(ldexp, (double __x, int __exp));
100 /* Natural logarithm of X. */
101 extern __CONSTVALUE double EXFUN(log, (double __x));
103 /* Base-ten logarithm of X. */
104 extern __CONSTVALUE double EXFUN(log10, (double __x));
107 /* Return exp(X) - 1. */
108 extern __CONSTVALUE double EXFUN(expm1, (double __x));
110 /* Return log(1 + X). */
111 extern __CONSTVALUE double EXFUN(log1p, (double __x));
114 /* Break VALUE into integral and fractional parts. */
115 extern double EXFUN(modf, (double __value, double *__iptr));
118 /* Power functions. */
120 /* Return X to the Y power. */
121 extern __CONSTVALUE double EXFUN(pow, (double __x, double __y));
123 /* Return the square root of X. */
124 extern __CONSTVALUE double EXFUN(sqrt, (double __x));
127 /* Return the cube root of X. */
128 extern __CONSTVALUE double EXFUN(cbrt, (double __x));
132 /* Nearest integer, absolute value, and remainder functions. */
134 /* Smallest integral value not less than X. */
135 extern __CONSTVALUE double EXFUN(ceil, (double __x));
137 /* Absolute value of X. */
138 extern __CONSTVALUE double EXFUN(fabs, (double __x));
140 /* Largest integer not greater than X. */
141 extern __CONSTVALUE double EXFUN(floor, (double __x));
143 /* Floating-point modulo remainder of X/Y. */
144 extern __CONSTVALUE double EXFUN(fmod, (double __x, double __y));
147 /* Return 0 if VALUE is finite or NaN, +1 if it
148 is +Infinity, -1 if it is -Infinity. */
149 extern __CONSTVALUE int EXFUN(__isinf, (double __value));
151 /* Return nonzero if VALUE is not a number. */
152 extern __CONSTVALUE int EXFUN(__isnan, (double __value));
154 /* Return nonzero if VALUE is finite and not NaN. */
155 extern __CONSTVALUE int EXFUN(__finite, (double __value));
157 #define __finite(value) (!__isinf(value))
160 /* Deal with an infinite or NaN result.
161 If ERROR is ERANGE, result is +Inf;
162 if ERROR is - ERANGE, result is -Inf;
163 otherwise result is NaN.
164 This will set `errno' to either ERANGE or EDOM,
165 and may return an infinity or NaN, or may do something else. */
166 extern double EXFUN(__infnan, (int __error));
168 /* Return X with its signed changed to Y's. */
169 extern __CONSTVALUE double EXFUN(__copysign, (double __x, double __y));
171 /* Return X times (2 to the Nth power). */
172 extern __CONSTVALUE double EXFUN(__scalb, (double __x, int __n));
175 #define __scalb(x, n) ldexp ((x), (n))
178 /* Return the remainder of X/Y. */
179 extern __CONSTVALUE double EXFUN(__drem, (double __x, double __y));
181 /* Return the base 2 signed integral exponent of X. */
182 extern __CONSTVALUE double EXFUN(__logb, (double __x));
186 /* Return the integer nearest X in the direction of the
187 prevailing rounding mode. */
188 extern __CONSTVALUE double EXFUN(rint, (double __x));
190 /* Return `sqrt(X*X + Y*Y)'. */
191 extern __CONSTVALUE double EXFUN(hypot, (double __x, double __y));
197 /* Return `sqrt(X*X + Y*Y)'. */
198 extern __CONSTVALUE double EXFUN(cabs, (struct __complex));
200 extern __CONSTVALUE int EXFUN(isinf, (double __value));
201 extern __CONSTVALUE int EXFUN(isnan, (double __value));
202 extern __CONSTVALUE int EXFUN(finite, (double __value));
203 extern __CONSTVALUE double EXFUN(infnan, (int __error));
204 extern __CONSTVALUE double EXFUN(copysign, (double __x, double __y));
205 extern __CONSTVALUE double EXFUN(scalb, (double __x, int __n));
206 extern __CONSTVALUE double EXFUN(drem, (double __x, double __y));
207 extern __CONSTVALUE double EXFUN(logb, (double __x));
210 #define isinf(value) __isinf(value)
211 #define isnan(value) __isnan(value)
212 #define infnan(error) __infnan(error)
213 #define finite(value) __finite(value)
214 #define copysign(x, y) __copysign((x), (y))
215 #define scalb(x, n) __scalb((x), (n))
216 #define drem(x, y) __drem((x), (y))
217 #define logb(x) __logb(x)
218 #endif /* Optimizing. */
220 #endif /* Use misc. */
224 /* The "Future Library Directions" section of the
225 ANSI Standard reserves these as `float' and
226 `long double' versions of the above functions. */
228 extern __CONSTVALUE float EXFUN(acosf, (float __x));
229 extern __CONSTVALUE float EXFUN(asinf, (float __x));
230 extern __CONSTVALUE float EXFUN(atanf, (float __x));
231 extern __CONSTVALUE float EXFUN(atan2f, (float __y, float __x));
232 extern __CONSTVALUE float EXFUN(cosf, (float __x));
233 extern __CONSTVALUE float EXFUN(sinf, (float __x));
234 extern __CONSTVALUE float EXFUN(tanf, (float __x));
235 extern __CONSTVALUE float EXFUN(coshf, (float __x));
236 extern __CONSTVALUE float EXFUN(sinhf, (float __x));
237 extern __CONSTVALUE float EXFUN(tanhf, (float __x));
238 extern __CONSTVALUE float EXFUN(expf, (float __x));
239 extern float EXFUN(frexpf, (float __value, int *__exp));
240 extern __CONSTVALUE float EXFUN(ldexpf, (float __x, int __exp));
241 extern __CONSTVALUE float EXFUN(logf, (float __x));
242 extern __CONSTVALUE float EXFUN(log10f, (float __x));
243 extern float EXFUN(modff, (float __value, float *__iptr));
244 extern __CONSTVALUE float EXFUN(powf, (float __x, float __y));
245 extern __CONSTVALUE float EXFUN(sqrtf, (float __x));
246 extern __CONSTVALUE float EXFUN(ceilf, (float __x));
247 extern __CONSTVALUE float EXFUN(fabsf, (float __x));
248 extern __CONSTVALUE float EXFUN(floorf, (float __x));
249 extern __CONSTVALUE float EXFUN(fmodf, (float __x, float __y));
251 extern __CONSTVALUE LONG_DOUBLE EXFUN(acosl, (LONG_DOUBLE __x));
252 extern __CONSTVALUE LONG_DOUBLE EXFUN(asinl, (LONG_DOUBLE __x));
253 extern __CONSTVALUE LONG_DOUBLE EXFUN(atanl, (LONG_DOUBLE __x));
254 extern __CONSTVALUE LONG_DOUBLE EXFUN(atan2l,
255 (LONG_DOUBLE __y, LONG_DOUBLE __x));
256 extern __CONSTVALUE LONG_DOUBLE EXFUN(cosl, (LONG_DOUBLE __x));
257 extern __CONSTVALUE LONG_DOUBLE EXFUN(sinl, (LONG_DOUBLE __x));
258 extern __CONSTVALUE LONG_DOUBLE EXFUN(tanl, (LONG_DOUBLE __x));
259 extern __CONSTVALUE LONG_DOUBLE EXFUN(coshl, (LONG_DOUBLE __x));
260 extern __CONSTVALUE LONG_DOUBLE EXFUN(sinhl, (LONG_DOUBLE __x));
261 extern __CONSTVALUE LONG_DOUBLE EXFUN(tanhl, (LONG_DOUBLE __x));
262 extern __CONSTVALUE LONG_DOUBLE EXFUN(expl, (LONG_DOUBLE __x));
263 extern LONG_DOUBLE EXFUN(frexpl, (LONG_DOUBLE __value, int *__exp));
264 extern __CONSTVALUE LONG_DOUBLE EXFUN(ldexpl, (LONG_DOUBLE __x, int __exp));
265 extern __CONSTVALUE LONG_DOUBLE EXFUN(logl, (LONG_DOUBLE __x));
266 extern __CONSTVALUE LONG_DOUBLE EXFUN(log10l, (LONG_DOUBLE __x));
267 extern LONG_DOUBLE EXFUN(modfl, (LONG_DOUBLE __value, LONG_DOUBLE *__ip));
268 extern __CONSTVALUE LONG_DOUBLE EXFUN(powl,
269 (LONG_DOUBLE __x, LONG_DOUBLE __y));
270 extern __CONSTVALUE LONG_DOUBLE EXFUN(sqrtl, (LONG_DOUBLE __x));
271 extern __CONSTVALUE LONG_DOUBLE EXFUN(ceill, (LONG_DOUBLE __x));
272 extern __CONSTVALUE LONG_DOUBLE EXFUN(fabsl, (LONG_DOUBLE __x));
273 extern __CONSTVALUE LONG_DOUBLE EXFUN(floorl, (LONG_DOUBLE __x));
274 extern __CONSTVALUE LONG_DOUBLE EXFUN(fmodl,
275 (LONG_DOUBLE __x, LONG_DOUBLE __y));
278 /* Get machine-dependent inline versions (if there are any). */