use the -newos toolchain even if -elf is present.
[newos.git] / include / math.h
blobcce376672a48eaabb15bf4d49a8244b186ae9769
1 /*
2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
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 * ====================================================
13 * from: @(#)fdlibm.h 5.1 93/09/24
14 * $FreeBSD: src/lib/msun/src/math.h,v 1.8 1999/08/28 00:06:42 peter Exp $
17 #ifndef _MATH_H_
18 #define _MATH_H_
21 * ANSI/POSIX
23 /* note: __builtin_inff() requires gcc 3.3 */
24 #define INFINITY (__builtin_inff())
25 #define HUGE_VAL (__builtin_inff())
28 * XOPEN/SVID
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) */
45 #define MAXFLOAT ((float)3.40282346638528860e+38)
46 extern int signgam;
48 #if !defined(_XOPEN_SOURCE)
49 enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
51 #define _LIB_VERSION_TYPE enum fdversion
52 #define _LIB_VERSION _fdlib_version
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
61 extern _LIB_VERSION_TYPE _LIB_VERSION;
63 #define _IEEE_ fdlibm_ieee
64 #define _SVID_ fdlibm_svid
65 #define _XOPEN_ fdlibm_xopen
66 #define _POSIX_ fdlibm_posix
68 #ifndef __cplusplus
69 struct exception {
70 int type;
71 char *name;
72 double arg1;
73 double arg2;
74 double retval;
76 #endif
78 #define HUGE MAXFLOAT
81 * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
82 * (one may replace the following line by "#include <values.h>")
85 #define X_TLOSS 1.41484755040568800000e+16
87 #define DOMAIN 1
88 #define SING 2
89 #define OVERFLOW 3
90 #define UNDERFLOW 4
91 #define TLOSS 5
92 #define PLOSS 6
94 #endif /* !_XOPEN_SOURCE */
95 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
98 #ifdef __cplusplus
99 extern "C"
101 #endif
104 * ANSI/POSIX
106 extern double acos(double);
107 extern double asin(double);
108 extern double atan(double);
109 extern double atan2(double, double);
110 extern double cos(double);
111 extern double sin(double);
112 extern double tan(double);
114 extern double cosh(double);
115 extern double sinh(double);
116 extern double tanh(double);
118 extern double exp(double);
119 extern double frexp(double, int *);
120 extern double ldexp(double, int);
121 extern double log(double);
122 extern double log10(double);
123 extern double modf(double, double *);
125 extern double pow(double, double);
126 extern double sqrt(double);
128 extern double ceil(double);
129 extern double fabs(double);
130 extern double floor(double);
131 extern double fmod(double, double);
133 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
134 extern double erf(double);
135 extern double erfc(double);
136 extern double gamma(double);
137 extern double hypot(double, double);
138 extern int isinf(double);
139 extern int isnan(double);
140 extern int finite(double);
141 extern double j0(double);
142 extern double j1(double);
143 extern double jn(int, double);
144 extern double lgamma(double);
145 extern double y0(double);
146 extern double y1(double);
147 extern double yn(int, double);
149 #if !defined(_XOPEN_SOURCE)
150 extern double acosh(double);
151 extern double asinh(double);
152 extern double atanh(double);
153 extern double cbrt(double);
154 extern double logb(double);
155 extern double nextafter(double, double);
156 extern double remainder(double, double);
157 extern double scalb(double, double);
159 #ifndef __cplusplus
160 extern int matherr(struct exception *);
161 #endif
164 * IEEE Test Vector
166 extern double significand(double);
169 * Functions callable from C, intended to support IEEE arithmetic.
171 extern double copysign(double, double);
172 extern int ilogb(double);
173 extern double rint(double);
174 extern double scalbn(double, int);
177 * BSD math library entry points
179 struct complex { double x, y; };
180 extern double cabs(struct complex);
181 extern double drem(double, double);
182 extern double expm1(double);
183 extern double log1p(double);
184 extern double z_abs(struct complex const *); /* complete non standard */
187 * Reentrant version of gamma & lgamma; passes signgam back by reference
188 * as the second argument; user must allocate space for signgam.
190 #ifdef _REENTRANT
191 extern double gamma_r(double, int *);
192 extern double lgamma_r(double, int *);
193 #endif /* _REENTRANT */
196 /* float versions of ANSI/POSIX functions */
197 extern float acosf(float);
198 extern float asinf(float);
199 extern float atanf(float);
200 extern float atan2f(float, float);
201 extern float cosf(float);
202 extern float sinf(float);
203 extern float tanf(float);
205 extern float coshf(float);
206 extern float sinhf(float);
207 extern float tanhf(float);
209 extern float expf(float);
210 extern float frexpf(float, int *);
211 extern float ldexpf(float, int);
212 extern float logf(float);
213 extern float log10f(float);
214 extern float modff(float, float *);
216 extern float powf(float, float);
217 extern float sqrtf(float);
219 extern float ceilf(float);
220 extern float fabsf(float);
221 extern float floorf(float);
222 extern float fmodf(float, float);
224 extern float erff(float);
225 extern float erfcf(float);
226 extern float gammaf(float);
227 extern float hypotf(float, float);
228 extern int isnanf(float);
229 extern int finitef(float);
230 extern float j0f(float);
231 extern float j1f(float);
232 extern float jnf(int, float);
233 extern float lgammaf(float);
234 extern float y0f(float);
235 extern float y1f(float);
236 extern float ynf(int, float);
238 extern float acoshf(float);
239 extern float asinhf(float);
240 extern float atanhf(float);
241 extern float cbrtf(float);
242 extern float logbf(float);
243 extern float nextafterf(float, float);
244 extern float remainderf(float, float);
245 extern float scalbf(float, float);
248 * float version of IEEE Test Vector
250 extern float significandf(float);
253 * Float versions of functions callable from C, intended to support
254 * IEEE arithmetic.
256 extern float copysignf(float, float);
257 extern int ilogbf(float);
258 extern float rintf(float);
259 extern float scalbnf(float, int);
262 * float versions of BSD math library entry points
264 extern float cabsf ();
265 extern float dremf(float, float);
266 extern float expm1f(float);
267 extern float log1pf(float);
270 * Float versions of reentrant version of gamma & lgamma; passes
271 * signgam back by reference as the second argument; user must
272 * allocate space for signgam.
274 #ifdef _REENTRANT
275 extern float gammaf_r(float, int *);
276 extern float lgammaf_r(float, int *);
277 #endif /* _REENTRANT */
279 #endif /* !_XOPEN_SOURCE */
280 #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
282 #ifdef __cplusplus
283 } /* "C" */
284 #endif
286 #if defined(__cplusplus) && !defined(_NEWOS_NO_LIBC_COMPAT)
289 #endif
291 #endif /* _MATH_H_ */