Rev 4973 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4973 | Rev 5098 | ||
---|---|---|---|
1 | /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ |
1 | /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ |
2 | /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ |
2 | /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ |
3 | /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
3 | /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
4 | #ifndef __dj_include_math_h_ |
4 | #ifndef __dj_include_math_h_ |
5 | #define __dj_include_math_h_ |
5 | #define __dj_include_math_h_ |
6 | 6 | ||
7 | #ifdef _USE_LIBM_MATH_H |
7 | #ifdef _USE_LIBM_MATH_H |
8 | #include |
8 | #include |
9 | #else |
9 | #else |
10 | 10 | ||
11 | #ifdef __cplusplus |
11 | #ifdef __cplusplus |
12 | extern "C" { |
12 | extern "C" { |
13 | #endif |
13 | #endif |
14 | 14 | ||
15 | #ifndef __dj_ENFORCE_ANSI_FREESTANDING |
15 | #ifndef __dj_ENFORCE_ANSI_FREESTANDING |
16 | 16 | ||
17 | extern double __dj_huge_val; |
17 | extern double __dj_huge_val; |
18 | #define HUGE_VAL __dj_huge_val |
18 | #define HUGE_VAL __dj_huge_val |
19 | 19 | ||
20 | double acos(double _x); |
20 | double acos(double _x); |
21 | double asin(double _x); |
21 | double asin(double _x); |
22 | double atan(double _x); |
22 | double atan(double _x); |
23 | double atan2(double _y, double _x); |
23 | double atan2(double _y, double _x); |
24 | double ceil(double _x); |
24 | double ceil(double _x); |
25 | double cos(double _x); |
25 | double cos(double _x); |
26 | double cosh(double _x); |
26 | double cosh(double _x); |
27 | double exp(double _x); |
27 | double exp(double _x); |
28 | double fabs(double _x); |
28 | double fabs(double _x); |
29 | double floor(double _x); |
29 | double floor(double _x); |
30 | double fmod(double _x, double _y); |
30 | double fmod(double _x, double _y); |
31 | double frexp(double _x, int *_pexp); |
31 | double frexp(double _x, int *_pexp); |
32 | double ldexp(double _x, int _exp); |
32 | double ldexp(double _x, int _exp); |
33 | double log(double _y); |
33 | double log(double _y); |
34 | double log10(double _x); |
34 | double log10(double _x); |
35 | double modf(double _x, double *_pint); |
35 | double modf(double _x, double *_pint); |
36 | double pow(double _x, double _y); |
36 | double pow(double _x, double _y); |
37 | double sin(double _x); |
37 | double sin(double _x); |
38 | double sinh(double _x); |
38 | double sinh(double _x); |
39 | double sqrt(double _x); |
39 | double sqrt(double _x); |
40 | double tan(double _x); |
40 | double tan(double _x); |
41 | double tanh(double _x); |
41 | double tanh(double _x); |
42 | 42 | ||
43 | #ifndef __STRICT_ANSI__ |
43 | #ifndef __STRICT_ANSI__ |
44 | 44 | ||
45 | #ifndef _POSIX_SOURCE |
45 | #ifndef _POSIX_SOURCE |
46 | 46 | ||
47 | #define M_E 2.7182818284590452354 |
47 | #define M_E 2.7182818284590452354 |
48 | #define M_LOG2E 1.4426950408889634074 |
48 | #define M_LOG2E 1.4426950408889634074 |
49 | #define M_LOG10E 0.43429448190325182765 |
49 | #define M_LOG10E 0.43429448190325182765 |
50 | #define M_LN2 0.69314718055994530942 |
50 | #define M_LN2 0.69314718055994530942 |
51 | #define M_LN10 2.30258509299404568402 |
51 | #define M_LN10 2.30258509299404568402 |
52 | #define M_PI 3.14159265358979323846 |
52 | #define M_PI 3.14159265358979323846 |
53 | #define M_PI_2 1.57079632679489661923 |
53 | #define M_PI_2 1.57079632679489661923 |
54 | #define M_PI_4 0.78539816339744830962 |
54 | #define M_PI_4 0.78539816339744830962 |
55 | #define M_1_PI 0.31830988618379067154 |
55 | #define M_1_PI 0.31830988618379067154 |
56 | #define M_2_PI 0.63661977236758134308 |
56 | #define M_2_PI 0.63661977236758134308 |
57 | #define M_2_SQRTPI 1.12837916709551257390 |
57 | #define M_2_SQRTPI 1.12837916709551257390 |
58 | #define M_SQRT2 1.41421356237309504880 |
58 | #define M_SQRT2 1.41421356237309504880 |
59 | #define M_SQRT1_2 0.70710678118654752440 |
59 | #define M_SQRT1_2 0.70710678118654752440 |
60 | #define PI M_PI |
60 | #define PI M_PI |
61 | #define PI2 M_PI_2 |
61 | #define PI2 M_PI_2 |
62 | 62 | ||
63 | double acosh(double); |
63 | double acosh(double); |
64 | double asinh(double); |
64 | double asinh(double); |
65 | double atanh(double); |
65 | double atanh(double); |
66 | double cbrt(double); |
66 | double cbrt(double); |
67 | double exp10(double _x); |
67 | double exp10(double _x); |
68 | double exp2(double _x); |
68 | double exp2(double _x); |
69 | double expm1(double); |
69 | double expm1(double); |
70 | double hypot(double, double); |
70 | double hypot(double, double); |
71 | double log1p(double); |
71 | double log1p(double); |
72 | double log2(double _x); |
72 | double log2(double _x); |
73 | long double modfl(long double _x, long double *_pint); |
73 | long double modfl(long double _x, long double *_pint); |
74 | double pow10(double _x); |
74 | double pow10(double _x); |
75 | double pow2(double _x); |
75 | double pow2(double _x); |
76 | double powi(double, int); |
76 | double powi(double, int); |
77 | void sincos(double *, double *, double); |
77 | void sincos(double, double *, double *); |
78 | 78 | ||
79 | /* These are in libm.a (Cygnus). You must link -lm to get these */ |
79 | /* These are in libm.a (Cygnus). You must link -lm to get these */ |
80 | /* See libm/math.h for comments */ |
80 | /* See libm/math.h for comments */ |
81 | 81 | ||
82 | #ifndef __cplusplus |
82 | #ifndef __cplusplus |
83 | struct exception { |
83 | struct exception { |
84 | int type; |
84 | int type; |
85 | const char *name; |
85 | const char *name; |
86 | double arg1; |
86 | double arg1; |
87 | double arg2; |
87 | double arg2; |
88 | double retval; |
88 | double retval; |
89 | int err; |
89 | int err; |
90 | }; |
90 | }; |
91 | #endif |
91 | #endif |
92 | 92 | ||
93 | extern double erf(double); |
93 | extern double erf(double); |
94 | extern double erfc(double); |
94 | extern double erfc(double); |
95 | extern double gamma(double); |
95 | extern double gamma(double); |
96 | extern int isinf(double); |
96 | extern int isinf(double); |
97 | extern int isnan(double); |
97 | extern int isnan(double); |
98 | extern int finite(double); |
98 | extern int finite(double); |
99 | extern double j0(double); |
99 | extern double j0(double); |
100 | extern double j1(double); |
100 | extern double j1(double); |
101 | extern double jn(int, double); |
101 | extern double jn(int, double); |
102 | extern double lgamma(double); |
102 | extern double lgamma(double); |
103 | extern double nan(void); |
103 | extern double nan(const char*); |
104 | extern double y0(double); |
104 | extern double y0(double); |
105 | extern double y1(double); |
105 | extern double y1(double); |
106 | extern double yn(int, double); |
106 | extern double yn(int, double); |
107 | extern double logb(double); |
107 | extern double logb(double); |
108 | extern double nextafter(double, double); |
108 | extern double nextafter(double, double); |
109 | extern double remainder(double, double); |
109 | extern double remainder(double, double); |
110 | extern double scalb(double, double); |
110 | extern double scalb(double, double); |
111 | #ifndef __cplusplus |
111 | #ifndef __cplusplus |
112 | extern int matherr(struct exception *); |
112 | extern int matherr(struct exception *); |
113 | #endif |
113 | #endif |
114 | extern double significand(double); |
114 | extern double significand(double); |
115 | extern double copysign(double, double); |
115 | extern double copysign(double, double); |
116 | extern int ilogb(double); |
116 | extern int ilogb(double); |
117 | extern double rint(double); |
117 | extern double rint(double); |
118 | extern double scalbn(double, int); |
118 | extern double scalbn(double, int); |
119 | extern double drem(double, double); |
119 | extern double drem(double, double); |
120 | extern double gamma_r(double, int *); |
120 | extern double gamma_r(double, int *); |
121 | extern double lgamma_r(double, int *); |
121 | extern double lgamma_r(double, int *); |
122 | extern float acosf(float); |
122 | extern float acosf(float); |
123 | extern float asinf(float); |
123 | extern float asinf(float); |
124 | extern float atanf(float); |
124 | extern float atanf(float); |
125 | extern float atan2f(float, float); |
125 | extern float atan2f(float, float); |
126 | extern float cosf(float); |
126 | extern float cosf(float); |
127 | extern float sinf(float); |
127 | extern float sinf(float); |
128 | extern float tanf(float); |
128 | extern float tanf(float); |
129 | extern float coshf(float); |
129 | extern float coshf(float); |
130 | extern float sinhf(float); |
130 | extern float sinhf(float); |
131 | extern float tanhf(float); |
131 | extern float tanhf(float); |
132 | extern float expf(float); |
132 | extern float expf(float); |
133 | extern float frexpf(float, int *); |
133 | extern float frexpf(float, int *); |
134 | extern float ldexpf(float, int); |
134 | extern float ldexpf(float, int); |
135 | extern float logf(float); |
135 | extern float logf(float); |
136 | extern float log10f(float); |
136 | extern float log10f(float); |
137 | extern float modff(float, float *); |
137 | extern float modff(float, float *); |
138 | extern float powf(float, float); |
138 | extern float powf(float, float); |
139 | extern float sqrtf(float); |
139 | extern float sqrtf(float); |
140 | extern float ceilf(float); |
140 | extern float ceilf(float); |
141 | extern float fabsf(float); |
141 | extern float fabsf(float); |
142 | extern float floorf(float); |
142 | extern float floorf(float); |
143 | extern float fmodf(float, float); |
143 | extern float fmodf(float, float); |
144 | extern float erff(float); |
144 | extern float erff(float); |
145 | extern float erfcf(float); |
145 | extern float erfcf(float); |
146 | extern float gammaf(float); |
146 | extern float gammaf(float); |
147 | extern float hypotf(float, float); |
147 | extern float hypotf(float, float); |
148 | extern int isinff(float); |
148 | extern int isinff(float); |
149 | extern int isnanf(float); |
149 | extern int isnanf(float); |
150 | extern int finitef(float); |
150 | extern int finitef(float); |
151 | extern float j0f(float); |
151 | extern float j0f(float); |
152 | extern float j1f(float); |
152 | extern float j1f(float); |
153 | extern float jnf(int, float); |
153 | extern float jnf(int, float); |
154 | extern float lgammaf(float); |
154 | extern float lgammaf(float); |
155 | extern float nanf(void); |
155 | extern float nanf(const char*); |
156 | extern float y0f(float); |
156 | extern float y0f(float); |
157 | extern float y1f(float); |
157 | extern float y1f(float); |
158 | extern float ynf(int, float); |
158 | extern float ynf(int, float); |
159 | extern float acoshf(float); |
159 | extern float acoshf(float); |
160 | extern float asinhf(float); |
160 | extern float asinhf(float); |
161 | extern float atanhf(float); |
161 | extern float atanhf(float); |
162 | extern float cbrtf(float); |
162 | extern float cbrtf(float); |
163 | extern float logbf(float); |
163 | extern float logbf(float); |
164 | extern float nextafterf(float, float); |
164 | extern float nextafterf(float, float); |
165 | extern float remainderf(float, float); |
165 | extern float remainderf(float, float); |
166 | extern float scalbf(float, float); |
166 | extern float scalbf(float, float); |
167 | extern float significandf(float); |
167 | extern float significandf(float); |
168 | extern float copysignf(float, float); |
168 | extern float copysignf(float, float); |
169 | extern int ilogbf(float); |
169 | extern int ilogbf(float); |
170 | extern float rintf(float); |
170 | extern float rintf(float); |
171 | extern float scalbnf(float, int); |
171 | extern float scalbnf(float, int); |
172 | extern float dremf(float, float); |
172 | extern float dremf(float, float); |
173 | extern float expm1f(float); |
173 | extern float expm1f(float); |
174 | extern float log1pf(float); |
174 | extern float log1pf(float); |
175 | extern float gammaf_r(float, int *); |
175 | extern float gammaf_r(float, int *); |
176 | extern float lgammaf_r(float, int *); |
176 | extern float lgammaf_r(float, int *); |
177 | 177 | ||
178 | #endif /* !_POSIX_SOURCE */ |
178 | #endif /* !_POSIX_SOURCE */ |
179 | #endif /* !__STRICT_ANSI__ */ |
179 | #endif /* !__STRICT_ANSI__ */ |
180 | #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ |
180 | #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ |
181 | 181 | ||
182 | #ifndef __dj_ENFORCE_FUNCTION_CALLS |
182 | #ifndef __dj_ENFORCE_FUNCTION_CALLS |
183 | #endif /* !__dj_ENFORCE_FUNCTION_CALLS */ |
183 | #endif /* !__dj_ENFORCE_FUNCTION_CALLS */ |
184 | 184 | ||
185 | #ifdef __cplusplus |
185 | #ifdef __cplusplus |
186 | } |
186 | } |
187 | #endif |
187 | #endif |
188 | 188 | ||
189 | #endif /* _USE_LIBM_MATH_H */ |
189 | #endif /* _USE_LIBM_MATH_H */ |
190 | 190 | ||
191 | #endif /* !__dj_include_math_h_ */ |
191 | #endif /* !__dj_include_math_h_ */ |