]> git.ipfire.org Git - thirdparty/glibc.git/blame - math/mathcalls.h
update from main archive 970129
[thirdparty/glibc.git] / math / mathcalls.h
CommitLineData
f7eac6eb 1/* Prototype declarations for math functions; helper file for <math.h>.
19361cb7 2 Copyright (C) 1996, 1997 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
41 both a `NAME' and a `NAMEf' that takes `float' arguments. */
42
43#ifndef _MATH_H
44 #error "Never include mathcalls.h directly; include <math.h> instead."
45#endif
46
47
48/* Trigonometric functions. */
49
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));
58
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));
65
66
67/* Hyperbolic functions. */
68
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));
75
2c6fe0bd 76#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
f7eac6eb
RM
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
84
85/* Exponential and logarithmic functions. */
86
6d52618b 87/* Exponential function of X. */
f7eac6eb
RM
88__MATHCALL (exp,, (_Mdouble_ __x));
89
90/* Break VALUE into a normalized fraction and an integral power of 2. */
afd4eb37 91__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
f7eac6eb
RM
92
93/* X times (two to the EXP power). */
afd4eb37 94__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
f7eac6eb
RM
95
96/* Natural logarithm of X. */
97__MATHCALL (log,, (_Mdouble_ __x));
98
99/* Base-ten logarithm of X. */
100__MATHCALL (log10,, (_Mdouble_ __x));
101
2c6fe0bd 102#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
f7eac6eb
RM
103/* Return exp(X) - 1. */
104__MATHCALL (expm1,, (_Mdouble_ __x));
105
106/* Return log(1 + X). */
107__MATHCALL (log1p,, (_Mdouble_ __x));
2c6fe0bd
UD
108
109/* Return the base 2 signed integral exponent of X. */
110__MATHCALL (logb,, (_Mdouble_ __x));
f7eac6eb
RM
111#endif
112
113/* Break VALUE into integral and fractional parts. */
afd4eb37 114__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
f7eac6eb
RM
115
116
117/* Power functions. */
118
119/* Return X to the Y power. */
120__MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
121
122/* Return the square root of X. */
123__MATHCALL (sqrt,, (_Mdouble_ __x));
124
2c6fe0bd 125#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
f7eac6eb
RM
126/* Return the cube root of X. */
127__MATHCALL (cbrt,, (_Mdouble_ __x));
128#endif
129
130
131/* Nearest integer, absolute value, and remainder functions. */
132
133/* Smallest integral value not less than X. */
134__MATHCALL (ceil,, (_Mdouble_ __x));
135
136/* Absolute value of X. */
137__MATHCALL (fabs,, (_Mdouble_ __x));
138
139/* Largest integer not greater than X. */
140__MATHCALL (floor,, (_Mdouble_ __x));
141
142/* Floating-point modulo remainder of X/Y. */
143__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
144
145
146#ifdef __USE_MISC
147
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));
151
f7eac6eb
RM
152/* Return nonzero if VALUE is finite and not NaN. */
153__MATHDECL (int, finite,, (_Mdouble_ __value));
154
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));
162
163/* Return X with its signed changed to Y's. */
164__MATHCALL (copysign,, (_Mdouble_ __x, _Mdouble_ __y));
165
f7eac6eb
RM
166/* Return X times (2 to the Nth power). */
167__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
168
169/* Return the remainder of X/Y. */
170__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
171
f7eac6eb
RM
172struct __MATH_PRECNAME(__cabs_complex,)
173{
174 _Mdouble_ x, y;
175};
176
177/* Return `sqrt(X*X + Y*Y)'. */
178__MATHCALL (cabs,, (struct __MATH_PRECNAME(__cabs_complex,)));
179
180
2c6fe0bd
UD
181/* Return the fractional part of X after dividing out `ilogb (X)'. */
182__MATHCALL (significand,, (_Mdouble_ __x));
183#endif /* Use misc. */
f7eac6eb 184
2c6fe0bd
UD
185
186#if defined(__USE_MISC) || defined(__USE_XOPEN)
187
188/* Return nonzero if VALUE is not a number. */
189__MATHDECL (int, isnan,, (_Mdouble_ __value));
f7eac6eb
RM
190
191/* Return the binary exponent of X, which must be nonzero. */
192__MATHDECL (int, ilogb,, (_Mdouble_ __x));
193
2c6fe0bd
UD
194/* Return `sqrt(X*X + Y*Y)'. */
195__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
f7eac6eb
RM
196
197
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_));
209
210/* This variable is used by `gamma' and `lgamma'. */
211extern int signgam;
212
19361cb7 213#ifdef __USE_MISC
f7eac6eb
RM
214
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
221
2c6fe0bd
UD
222
223#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
224
225/* Return the integer nearest X in the direction of the
226 prevailing rounding mode. */
227__MATHCALL (rint,, (_Mdouble_ __x));
228
229/* Return X times (2 to the Nth power). */
230__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
231
232/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
233__MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
234
235/* Return the remainder of integer divison X / Y with infinite precision. */
236__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
237#endif
238
f7eac6eb 239#endif /* Use misc. */