Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4973 | right-hear | 1 | /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ |
2 | /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
||
3 | /* Provided by Cygnus Support (jtc@cygnus.com) */ |
||
4 | |||
5 | /* |
||
6 | * ==================================================== |
||
7 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
||
8 | * |
||
9 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
||
10 | * Permission to use, copy, modify, and distribute this |
||
11 | * software is freely granted, provided that this notice |
||
12 | * is preserved. |
||
13 | * ==================================================== |
||
14 | */ |
||
15 | |||
16 | /* |
||
17 | * from: @(#)fdlibm.h 5.1 93/09/24 |
||
18 | * $Id: math.h,v 1.3 1999/07/04 14:37:08 eliz Exp $ |
||
19 | */ |
||
20 | |||
21 | #ifndef _MATH_H_ |
||
22 | #define _MATH_H_ |
||
23 | |||
24 | /* |
||
25 | * ANSI/POSIX |
||
26 | */ |
||
27 | typedef int __int32_t; |
||
28 | typedef unsigned int __uint32_t; |
||
29 | |||
30 | union __dmath |
||
31 | { |
||
32 | __uint32_t i[2]; |
||
33 | double d; |
||
34 | }; |
||
35 | |||
36 | extern const union __dmath __infinity; |
||
37 | #define HUGE_VAL (__infinity.d) |
||
38 | |||
39 | /* |
||
40 | * XOPEN/SVID |
||
41 | */ |
||
42 | #if !defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE) |
||
43 | #define M_E 2.7182818284590452354 /* e */ |
||
44 | #define M_LOG2E 1.4426950408889634074 /* log 2e */ |
||
45 | #define M_LOG10E 0.43429448190325182765 /* log 10e */ |
||
46 | #define M_LN2 0.693147180559945309417 /* log e2 */ |
||
47 | #define M_LN10 2.30258509299404568402 /* log e10 */ |
||
48 | #define M_PI 3.14159265358979323846 /* pi */ |
||
49 | #define M_TWOPI 6.28318530717958647692 /* 2*pi */ |
||
50 | #define M_PI_2 1.57079632679489661923 /* pi/2 */ |
||
51 | #define M_PI_4 0.78539816339744830962 /* pi/4 */ |
||
52 | #define M_3PI_4 2.3561944901923448370 /* 3/4 * pi */ |
||
53 | #define M_SQRTPI 1.77245385090551602792981 /* sqrt(pi) */ |
||
54 | #define M_1_PI 0.31830988618379067154 /* 1/pi */ |
||
55 | #define M_2_PI 0.63661977236758134308 /* 2/pi */ |
||
56 | #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ |
||
57 | #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ |
||
58 | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ |
||
59 | #define M_LN2LO 1.9082149292705877000E-10 /* lower bits of log e2 */ |
||
60 | #define M_LN2HI 6.9314718036912381649E-1 /* log e2 */ |
||
61 | #define M_SQRT3 1.73205080756887719000 /* sqrt(3) */ |
||
62 | #define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ |
||
63 | #define M_LOG2_E 0.693147180559945309417 |
||
64 | #define M_INVLN2 1.4426950408889633870E0 /* 1 / log e2 */ |
||
65 | |||
66 | extern int signgam; |
||
67 | |||
68 | enum __fdlibm_version |
||
69 | { |
||
70 | __fdlibm_ieee = -1, |
||
71 | __fdlibm_svid, |
||
72 | __fdlibm_xopen, |
||
73 | __fdlibm_posix |
||
74 | }; |
||
75 | |||
76 | #define _LIB_VERSION_TYPE enum __fdlibm_version |
||
77 | #define _LIB_VERSION __fdlib_version |
||
78 | |||
79 | /* if global variable _LIB_VERSION is not desirable, one may |
||
80 | * change the following to be a constant by: |
||
81 | * #define _LIB_VERSION_TYPE const enum version |
||
82 | * In that case, after one initializes the value _LIB_VERSION (see |
||
83 | * s_lib_version.c) during compile time, it cannot be modified |
||
84 | * in the middle of a program |
||
85 | */ |
||
86 | extern _LIB_VERSION_TYPE _LIB_VERSION; |
||
87 | |||
88 | #define _IEEE_ __fdlibm_ieee |
||
89 | #define _SVID_ __fdlibm_svid |
||
90 | #define _XOPEN_ __fdlibm_xopen |
||
91 | #define _POSIX_ __fdlibm_posix |
||
92 | |||
93 | /* The exception structure passed to the matherr routine. */ |
||
94 | |||
95 | #ifndef __cplusplus |
||
96 | struct exception |
||
97 | { |
||
98 | int type; |
||
99 | const char *name; |
||
100 | double arg1; |
||
101 | double arg2; |
||
102 | double retval; |
||
103 | int err; |
||
104 | }; |
||
105 | #endif |
||
106 | |||
107 | /* |
||
108 | * set X_TLOSS = pi*2**52, which is possibly defined in |
||
109 | * (one may replace the following line by "#include |
||
110 | */ |
||
111 | |||
112 | #define X_TLOSS 1.41484755040568800000e+16 |
||
113 | |||
114 | #define DOMAIN 1 |
||
115 | #define SING 2 |
||
116 | #define OVERFLOW 3 |
||
117 | #define UNDERFLOW 4 |
||
118 | #define TLOSS 5 |
||
119 | #define PLOSS 6 |
||
120 | |||
121 | #endif /* !__STRICT_ANSI__ && !_POSIX_SOURCE */ |
||
122 | |||
123 | |||
124 | #include |
||
125 | __BEGIN_DECLS |
||
126 | |||
127 | /* |
||
128 | * ANSI/POSIX |
||
129 | */ |
||
130 | extern double acos __P((double)); |
||
131 | extern double asin __P((double)); |
||
132 | extern double atan __P((double)); |
||
133 | extern double atan2 __P((double, double)); |
||
134 | extern double cos __P((double)); |
||
135 | extern double sin __P((double)); |
||
136 | extern double tan __P((double)); |
||
137 | |||
138 | extern double cosh __P((double)); |
||
139 | extern double sinh __P((double)); |
||
140 | extern double tanh __P((double)); |
||
141 | |||
142 | extern double exp __P((double)); |
||
143 | extern double frexp __P((double, int *)); |
||
144 | extern double ldexp __P((double, int)); |
||
145 | extern double log __P((double)); |
||
146 | extern double log10 __P((double)); |
||
147 | extern double modf __P((double, double *)); |
||
148 | |||
149 | extern double pow __P((double, double)); |
||
150 | extern double sqrt __P((double)); |
||
151 | |||
152 | extern double ceil __P((double)); |
||
153 | extern double fabs __P((double)); |
||
154 | extern double floor __P((double)); |
||
155 | extern double fmod __P((double, double)); |
||
156 | |||
157 | #if !defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE) |
||
158 | extern double erf __P((double)); |
||
159 | extern double erfc __P((double)); |
||
160 | extern double gamma __P((double)); |
||
161 | extern double hypot __P((double, double)); |
||
162 | extern double infinity __P((void)); |
||
163 | extern int isinf __P((double)); |
||
164 | extern int isnan __P((double)); |
||
165 | extern int finite __P((double)); |
||
166 | extern double j0 __P((double)); |
||
167 | extern double j1 __P((double)); |
||
168 | extern double jn __P((int, double)); |
||
169 | extern double lgamma __P((double)); |
||
170 | extern double nan __P((void)); |
||
171 | extern double y0 __P((double)); |
||
172 | extern double y1 __P((double)); |
||
173 | extern double yn __P((int, double)); |
||
174 | extern double log2 __P((double)); |
||
175 | |||
176 | #if !defined(_XOPEN_SOURCE) |
||
177 | extern double acosh __P((double)); |
||
178 | extern double asinh __P((double)); |
||
179 | extern double atanh __P((double)); |
||
180 | extern double cbrt __P((double)); |
||
181 | extern double exp10 __P((double)); |
||
182 | extern double exp2 __P((double)); |
||
183 | extern double log1p __P((double)); |
||
184 | extern double logb __P((double)); |
||
185 | extern long double modfl __P((long double, long double *)); |
||
186 | extern double nextafter __P((double, double)); |
||
187 | extern double pow10 __P((double)); |
||
188 | extern double pow2 __P((double)); |
||
189 | extern double powi __P((double, int)); |
||
190 | extern void sincos __P((double *, double *, double)); |
||
191 | extern double remainder __P((double, double)); |
||
192 | extern double scalb __P((double, double)); |
||
193 | |||
194 | #ifndef __cplusplus |
||
195 | extern int matherr __P((struct exception *)); |
||
196 | #endif |
||
197 | |||
198 | /* |
||
199 | * IEEE Test Vector |
||
200 | */ |
||
201 | extern double significand __P((double)); |
||
202 | |||
203 | /* |
||
204 | * Functions callable from C, intended to support IEEE arithmetic. |
||
205 | */ |
||
206 | extern double copysign __P((double, double)); |
||
207 | extern int ilogb __P((double)); |
||
208 | extern double rint __P((double)); |
||
209 | extern double scalbn __P((double, int)); |
||
210 | |||
211 | /* |
||
212 | * BSD math library entry points |
||
213 | */ |
||
214 | extern double drem __P((double, double)); |
||
215 | extern double expm1 __P((double)); |
||
216 | extern double log1p __P((double)); |
||
217 | |||
218 | /* |
||
219 | * Reentrant version of gamma & lgamma; passes signgam back by reference |
||
220 | * as the second argument; user must allocate space for signgam. |
||
221 | */ |
||
222 | extern double gamma_r __P((double, int *)); |
||
223 | extern double lgamma_r __P((double, int *)); |
||
224 | |||
225 | |||
226 | /* float versions of ANSI/POSIX functions */ |
||
227 | extern float acosf __P((float)); |
||
228 | extern float asinf __P((float)); |
||
229 | extern float atanf __P((float)); |
||
230 | extern float atan2f __P((float, float)); |
||
231 | extern float cosf __P((float)); |
||
232 | extern float sinf __P((float)); |
||
233 | extern float tanf __P((float)); |
||
234 | |||
235 | extern float coshf __P((float)); |
||
236 | extern float sinhf __P((float)); |
||
237 | extern float tanhf __P((float)); |
||
238 | |||
239 | extern float expf __P((float)); |
||
240 | extern float frexpf __P((float, int *)); |
||
241 | extern float ldexpf __P((float, int)); |
||
242 | extern float logf __P((float)); |
||
243 | extern float log10f __P((float)); |
||
244 | extern float modff __P((float, float *)); |
||
245 | |||
246 | extern float powf __P((float, float)); |
||
247 | extern float sqrtf __P((float)); |
||
248 | |||
249 | extern float ceilf __P((float)); |
||
250 | extern float fabsf __P((float)); |
||
251 | extern float floorf __P((float)); |
||
252 | extern float fmodf __P((float, float)); |
||
253 | |||
254 | extern float erff __P((float)); |
||
255 | extern float erfcf __P((float)); |
||
256 | extern float gammaf __P((float)); |
||
257 | extern float hypotf __P((float, float)); |
||
258 | extern float infinityf __P((void)); |
||
259 | extern int isinff __P((float)); |
||
260 | extern int isnanf __P((float)); |
||
261 | extern int finitef __P((float)); |
||
262 | extern float j0f __P((float)); |
||
263 | extern float j1f __P((float)); |
||
264 | extern float jnf __P((int, float)); |
||
265 | extern float lgammaf __P((float)); |
||
266 | extern float nanf __P((void)); |
||
267 | extern float y0f __P((float)); |
||
268 | extern float y1f __P((float)); |
||
269 | extern float ynf __P((int, float)); |
||
270 | #define log2f(x) (logf (x) / (float) M_LOG2_E) |
||
271 | |||
272 | extern float acoshf __P((float)); |
||
273 | extern float asinhf __P((float)); |
||
274 | extern float atanhf __P((float)); |
||
275 | extern float cbrtf __P((float)); |
||
276 | extern float logbf __P((float)); |
||
277 | extern float nextafterf __P((float, float)); |
||
278 | extern float remainderf __P((float, float)); |
||
279 | extern float scalbf __P((float, float)); |
||
280 | |||
281 | /* |
||
282 | * float version of IEEE Test Vector |
||
283 | */ |
||
284 | extern float significandf __P((float)); |
||
285 | |||
286 | /* |
||
287 | * Float versions of functions callable from C, intended to support |
||
288 | * IEEE arithmetic. |
||
289 | */ |
||
290 | extern float copysignf __P((float, float)); |
||
291 | extern int ilogbf __P((float)); |
||
292 | extern float rintf __P((float)); |
||
293 | extern float scalbnf __P((float, int)); |
||
294 | |||
295 | /* |
||
296 | * float versions of BSD math library entry points |
||
297 | */ |
||
298 | extern float dremf __P((float, float)); |
||
299 | extern float expm1f __P((float)); |
||
300 | extern float log1pf __P((float)); |
||
301 | |||
302 | /* |
||
303 | * Float versions of reentrant version of gamma & lgamma; passes |
||
304 | * signgam back by reference as the second argument; user must |
||
305 | * allocate space for signgam. |
||
306 | */ |
||
307 | extern float gammaf_r __P((float, int *)); |
||
308 | extern float lgammaf_r __P((float, int *)); |
||
309 | |||
310 | #endif /* !_XOPEN_SOURCE */ |
||
311 | #endif /* !__STRICT_ANSI__ && !_POSIX_SOURCE */ |
||
312 | |||
313 | __END_DECLS |
||
314 | |||
315 | #endif /* _MATH_H_ */ |