Update from main archive 961219
[glibc.git] / math / mathcalls.h
blob1f958c0d8909c0c92071ddd73bb59eab0e4b16ff
1 /* Prototype declarations for math functions; helper file for <math.h>.
2 Copyright (C) 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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. */
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.
24 This file provides prototype declarations for the math functions.
25 Most functions are declared using the macro:
27 __MATHCALL (NAME,[_r], (ARGS...));
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'.
35 Functions returning other types like `int' are declared using the macro:
37 __MATHDECL (TYPE, NAME,[_r], (ARGS...));
39 This is just like __MATHCALL but for a function returning `TYPE'
40 instead of `_Mdouble_'. In all of these cases, there is still
41 both a `NAME' and a `NAMEf' that takes `float' arguments. */
43 #ifndef _MATH_H
44 #error "Never include mathcalls.h directly; include <math.h> instead."
45 #endif
48 /* Trigonometric functions. */
50 /* Arc cosine of X. */
51 __MATHCALL (acos,, (_Mdouble_ __x));
52 /* Arc sine of X. */
53 __MATHCALL (asin,, (_Mdouble_ __x));
54 /* Arc tangent of X. */
55 __MATHCALL (atan,, (_Mdouble_ __x));
56 /* Arc tangent of Y/X. */
57 __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x));
59 /* Cosine of X. */
60 __MATHCALL (cos,, (_Mdouble_ __x));
61 /* Sine of X. */
62 __MATHCALL (sin,, (_Mdouble_ __x));
63 /* Tangent of X. */
64 __MATHCALL (tan,, (_Mdouble_ __x));
67 /* Hyperbolic functions. */
69 /* Hyperbolic cosine of X. */
70 __MATHCALL (cosh,, (_Mdouble_ __x));
71 /* Hyperbolic sine of X. */
72 __MATHCALL (sinh,, (_Mdouble_ __x));
73 /* Hyperbolic tangent of X. */
74 __MATHCALL (tanh,, (_Mdouble_ __x));
76 #if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
77 /* Hyperbolic arc cosine of X. */
78 __MATHCALL (acosh,, (_Mdouble_ __x));
79 /* Hyperbolic arc sine of X. */
80 __MATHCALL (asinh,, (_Mdouble_ __x));
81 /* Hyperbolic arc tangent of X. */
82 __MATHCALL (atanh,, (_Mdouble_ __x));
83 #endif
85 /* Exponential and logarithmic functions. */
87 /* Exponential function of X. */
88 __MATHCALL (exp,, (_Mdouble_ __x));
90 /* Break VALUE into a normalized fraction and an integral power of 2. */
91 __MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
93 /* X times (two to the EXP power). */
94 __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
96 /* Natural logarithm of X. */
97 __MATHCALL (log,, (_Mdouble_ __x));
99 /* Base-ten logarithm of X. */
100 __MATHCALL (log10,, (_Mdouble_ __x));
102 #if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
103 /* Return exp(X) - 1. */
104 __MATHCALL (expm1,, (_Mdouble_ __x));
106 /* Return log(1 + X). */
107 __MATHCALL (log1p,, (_Mdouble_ __x));
109 /* Return the base 2 signed integral exponent of X. */
110 __MATHCALL (logb,, (_Mdouble_ __x));
111 #endif
113 /* Break VALUE into integral and fractional parts. */
114 __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
117 /* Power functions. */
119 /* Return X to the Y power. */
120 __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
122 /* Return the square root of X. */
123 __MATHCALL (sqrt,, (_Mdouble_ __x));
125 #if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
126 /* Return the cube root of X. */
127 __MATHCALL (cbrt,, (_Mdouble_ __x));
128 #endif
131 /* Nearest integer, absolute value, and remainder functions. */
133 /* Smallest integral value not less than X. */
134 __MATHCALL (ceil,, (_Mdouble_ __x));
136 /* Absolute value of X. */
137 __MATHCALL (fabs,, (_Mdouble_ __x));
139 /* Largest integer not greater than X. */
140 __MATHCALL (floor,, (_Mdouble_ __x));
142 /* Floating-point modulo remainder of X/Y. */
143 __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
146 #ifdef __USE_MISC
148 /* Return 0 if VALUE is finite or NaN, +1 if it
149 is +Infinity, -1 if it is -Infinity. */
150 __MATHDECL (int, isinf,, (_Mdouble_ __value));
152 /* Return nonzero if VALUE is finite and not NaN. */
153 __MATHDECL (int, finite,, (_Mdouble_ __value));
155 /* Deal with an infinite or NaN result.
156 If ERROR is ERANGE, result is +Inf;
157 if ERROR is - ERANGE, result is -Inf;
158 otherwise result is NaN.
159 This will set `errno' to either ERANGE or EDOM,
160 and may return an infinity or NaN, or may do something else. */
161 __MATHCALL (infnan,, (int __error));
163 /* Return X with its signed changed to Y's. */
164 __MATHCALL (copysign,, (_Mdouble_ __x, _Mdouble_ __y));
166 /* Return X times (2 to the Nth power). */
167 __MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
169 /* Return the remainder of X/Y. */
170 __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
172 struct __MATH_PRECNAME(__cabs_complex,)
174 _Mdouble_ x, y;
177 /* Return `sqrt(X*X + Y*Y)'. */
178 __MATHCALL (cabs,, (struct __MATH_PRECNAME(__cabs_complex,)));
181 /* Return the fractional part of X after dividing out `ilogb (X)'. */
182 __MATHCALL (significand,, (_Mdouble_ __x));
183 #endif /* Use misc. */
186 #if defined(__USE_MISC) || defined(__USE_XOPEN)
188 /* Return nonzero if VALUE is not a number. */
189 __MATHDECL (int, isnan,, (_Mdouble_ __value));
191 /* Return the binary exponent of X, which must be nonzero. */
192 __MATHDECL (int, ilogb,, (_Mdouble_ __x));
194 /* Return `sqrt(X*X + Y*Y)'. */
195 __MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
198 /* Error, gamma, and Bessel functions. */
199 __MATHCALL (erf,, (_Mdouble_));
200 __MATHCALL (erfc,, (_Mdouble_));
201 __MATHCALL (gamma,, (_Mdouble_));
202 __MATHCALL (j0,, (_Mdouble_));
203 __MATHCALL (j1,, (_Mdouble_));
204 __MATHCALL (jn,, (int, _Mdouble_));
205 __MATHCALL (lgamma,, (_Mdouble_));
206 __MATHCALL (y0,, (_Mdouble_));
207 __MATHCALL (y1,, (_Mdouble_));
208 __MATHCALL (yn,, (int, _Mdouble_));
210 /* This variable is used by `gamma' and `lgamma'. */
211 extern int signgam;
213 #ifdef __USE_REENTRANT
215 /* Reentrant versions of gamma and lgamma. Those functions use the global
216 variable `signgam'. The reentrant versions instead take a pointer and
217 store the value through it. */
218 __MATHCALL (gamma,_r, (_Mdouble_, int *));
219 __MATHCALL (lgamma,_r, (_Mdouble_, int *));
220 #endif
223 #if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
225 /* Return the integer nearest X in the direction of the
226 prevailing rounding mode. */
227 __MATHCALL (rint,, (_Mdouble_ __x));
229 /* Return X times (2 to the Nth power). */
230 __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
232 /* Return X + epsilon if X < Y, X - epsilon if X > Y. */
233 __MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
235 /* Return the remainder of integer divison X / Y with infinite precision. */
236 __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
237 #endif
239 #endif /* Use misc. */