Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / lib / msun / src / math.h
1 /*
2  * ====================================================
3  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4  *
5  * Developed at SunPro, a Sun Microsystems, Inc. business.
6  * Permission to use, copy, modify, and distribute this
7  * software is freely granted, provided that this notice
8  * is preserved.
9  * ====================================================
10  */
11
12 /*
13  * from: @(#)fdlibm.h 5.1 93/09/24
14  * $FreeBSD: src/lib/msun/src/math.h,v 1.8.2.2 2001/11/23 16:16:18 dd Exp $
15  * $DragonFly: src/lib/msun/src/Attic/math.h,v 1.2 2003/06/17 04:26:53 dillon Exp $
16  */
17
18 #ifndef _MATH_H_
19 #define _MATH_H_
20
21 /*
22  * ANSI/POSIX
23  */
24 extern char __infinity[];
25 #define HUGE_VAL        (*(double *) __infinity)
26
27 /*
28  * XOPEN/SVID
29  */
30 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
31 #define M_E             2.7182818284590452354   /* e */
32 #define M_LOG2E         1.4426950408889634074   /* log 2e */
33 #define M_LOG10E        0.43429448190325182765  /* log 10e */
34 #define M_LN2           0.69314718055994530942  /* log e2 */
35 #define M_LN10          2.30258509299404568402  /* log e10 */
36 #define M_PI            3.14159265358979323846  /* pi */
37 #define M_PI_2          1.57079632679489661923  /* pi/2 */
38 #define M_PI_4          0.78539816339744830962  /* pi/4 */
39 #define M_1_PI          0.31830988618379067154  /* 1/pi */
40 #define M_2_PI          0.63661977236758134308  /* 2/pi */
41 #define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
42 #define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
43 #define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
44
45 #define MAXFLOAT        ((float)3.40282346638528860e+38)
46 extern int signgam;
47
48 #if !defined(_XOPEN_SOURCE)
49 enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
50
51 #define _LIB_VERSION_TYPE enum fdversion
52 #define _LIB_VERSION _fdlib_version
53
54 /* if global variable _LIB_VERSION is not desirable, one may
55  * change the following to be a constant by:
56  *      #define _LIB_VERSION_TYPE const enum version
57  * In that case, after one initializes the value _LIB_VERSION (see
58  * s_lib_version.c) during compile time, it cannot be modified
59  * in the middle of a program
60  */
61 extern  _LIB_VERSION_TYPE  _LIB_VERSION;
62
63 #define _IEEE_  fdlibm_ieee
64 #define _SVID_  fdlibm_svid
65 #define _XOPEN_ fdlibm_xopen
66 #define _POSIX_ fdlibm_posix
67
68 /* We have a problem when using C++ since `exception' is a reserved
69    name in C++.  */
70 #ifndef __cplusplus
71 struct exception {
72         int type;
73         char *name;
74         double arg1;
75         double arg2;
76         double retval;
77 };
78 #endif
79
80 #define HUGE            MAXFLOAT
81
82 /*
83  * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
84  * (one may replace the following line by "#include <values.h>")
85  */
86
87 #define X_TLOSS         1.41484755040568800000e+16
88
89 #define DOMAIN          1
90 #define SING            2
91 #define OVERFLOW        3
92 #define UNDERFLOW       4
93 #define TLOSS           5
94 #define PLOSS           6
95
96 #endif /* !_XOPEN_SOURCE */
97 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
98
99
100 #include <sys/cdefs.h>
101 __BEGIN_DECLS
102 /*
103  * ANSI/POSIX
104  */
105 extern double acos __P((double));
106 extern double asin __P((double));
107 extern double atan __P((double));
108 extern double atan2 __P((double, double));
109 extern double cos __P((double));
110 extern double sin __P((double));
111 extern double tan __P((double));
112
113 extern double cosh __P((double));
114 extern double sinh __P((double));
115 extern double tanh __P((double));
116
117 extern double exp __P((double));
118 extern double frexp __P((double, int *));
119 extern double ldexp __P((double, int));
120 extern double log __P((double));
121 extern double log10 __P((double));
122 extern double modf __P((double, double *));
123
124 extern double pow __P((double, double));
125 extern double sqrt __P((double));
126
127 extern double ceil __P((double));
128 extern double fabs __P((double));
129 extern double floor __P((double));
130 extern double fmod __P((double, double));
131
132 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
133 extern double erf __P((double));
134 extern double erfc __P((double));
135 extern double gamma __P((double));
136 extern double hypot __P((double, double));
137 extern int isinf __P((double));
138 extern int isnan __P((double));
139 extern int finite __P((double));
140 extern double j0 __P((double));
141 extern double j1 __P((double));
142 extern double jn __P((int, double));
143 extern double lgamma __P((double));
144 extern double y0 __P((double));
145 extern double y1 __P((double));
146 extern double yn __P((int, double));
147
148 #if !defined(_XOPEN_SOURCE)
149 extern double acosh __P((double));
150 extern double asinh __P((double));
151 extern double atanh __P((double));
152 extern double cbrt __P((double));
153 extern double logb __P((double));
154 extern double nextafter __P((double, double));
155 extern double remainder __P((double, double));
156 extern double scalb __P((double, double));
157
158 #ifndef __cplusplus
159 extern int matherr __P((struct exception *));
160 #endif
161
162 /*
163  * IEEE Test Vector
164  */
165 extern double significand __P((double));
166
167 /*
168  * Functions callable from C, intended to support IEEE arithmetic.
169  */
170 extern double copysign __P((double, double));
171 extern int ilogb __P((double));
172 extern double rint __P((double));
173 extern double scalbn __P((double, int));
174
175 /*
176  * BSD math library entry points
177  */
178 extern double drem __P((double, double));
179 extern double expm1 __P((double));
180 extern double log1p __P((double));
181
182 /*
183  * Reentrant version of gamma & lgamma; passes signgam back by reference
184  * as the second argument; user must allocate space for signgam.
185  */
186 #ifdef _REENTRANT
187 extern double gamma_r __P((double, int *));
188 extern double lgamma_r __P((double, int *));
189 #endif /* _REENTRANT */
190
191
192 /* float versions of ANSI/POSIX functions */
193 extern float acosf __P((float));
194 extern float asinf __P((float));
195 extern float atanf __P((float));
196 extern float atan2f __P((float, float));
197 extern float cosf __P((float));
198 extern float sinf __P((float));
199 extern float tanf __P((float));
200
201 extern float coshf __P((float));
202 extern float sinhf __P((float));
203 extern float tanhf __P((float));
204
205 extern float expf __P((float));
206 extern float frexpf __P((float, int *));
207 extern float ldexpf __P((float, int));
208 extern float logf __P((float));
209 extern float log10f __P((float));
210 extern float modff __P((float, float *));
211
212 extern float powf __P((float, float));
213 extern float sqrtf __P((float));
214
215 extern float ceilf __P((float));
216 extern float fabsf __P((float));
217 extern float floorf __P((float));
218 extern float fmodf __P((float, float));
219
220 extern float erff __P((float));
221 extern float erfcf __P((float));
222 extern float gammaf __P((float));
223 extern float hypotf __P((float, float));
224 extern int isnanf __P((float));
225 extern int finitef __P((float));
226 extern float j0f __P((float));
227 extern float j1f __P((float));
228 extern float jnf __P((int, float));
229 extern float lgammaf __P((float));
230 extern float y0f __P((float));
231 extern float y1f __P((float));
232 extern float ynf __P((int, float));
233
234 extern float acoshf __P((float));
235 extern float asinhf __P((float));
236 extern float atanhf __P((float));
237 extern float cbrtf __P((float));
238 extern float logbf __P((float));
239 extern float nextafterf __P((float, float));
240 extern float remainderf __P((float, float));
241 extern float scalbf __P((float, float));
242
243 /*
244  * float version of IEEE Test Vector
245  */
246 extern float significandf __P((float));
247
248 /*
249  * Float versions of functions callable from C, intended to support
250  * IEEE arithmetic.
251  */
252 extern float copysignf __P((float, float));
253 extern int ilogbf __P((float));
254 extern float rintf __P((float));
255 extern float scalbnf __P((float, int));
256
257 /*
258  * float versions of BSD math library entry points
259  */
260 extern float dremf __P((float, float));
261 extern float expm1f __P((float));
262 extern float log1pf __P((float));
263
264 /*
265  * Float versions of reentrant version of gamma & lgamma; passes
266  * signgam back by reference as the second argument; user must
267  * allocate space for signgam.
268  */
269 #ifdef _REENTRANT
270 extern float gammaf_r __P((float, int *));
271 extern float lgammaf_r __P((float, int *));
272 #endif  /* _REENTRANT */
273
274 #endif /* !_XOPEN_SOURCE */
275 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
276 __END_DECLS
277
278 #endif /* _MATH_H_ */