OLD | NEW |
1 #ifndef _MATH_H | 1 #ifndef _MATH_H |
2 #define _MATH_H | 2 #define _MATH_H |
3 | 3 |
4 #ifdef __cplusplus | 4 #ifdef __cplusplus |
5 extern "C" { | 5 extern "C" { |
6 #endif | 6 #endif |
7 | 7 |
8 #include <features.h> | 8 #include <features.h> |
9 | 9 |
10 #define __NEED_float_t | 10 #define __NEED_float_t |
11 #define __NEED_double_t | 11 #define __NEED_double_t |
12 #include <bits/alltypes.h> | 12 #include <bits/alltypes.h> |
13 | 13 |
14 #if 100*__GNUC__+__GNUC_MINOR__ >= 303 | 14 #if 100 * __GNUC__ + __GNUC_MINOR__ >= 303 |
15 #define NAN __builtin_nanf("") | 15 #define NAN __builtin_nanf("") |
16 #define INFINITY __builtin_inff() | 16 #define INFINITY __builtin_inff() |
17 #else | 17 #else |
18 #define NAN (0.0f/0.0f) | 18 #define NAN (0.0f / 0.0f) |
19 #define INFINITY 1e5000f | 19 #define INFINITY 1e5000f |
20 #endif | 20 #endif |
21 | 21 |
22 #define HUGE_VALF INFINITY | 22 #define HUGE_VALF INFINITY |
23 #define HUGE_VAL ((double)INFINITY) | 23 #define HUGE_VAL ((double)INFINITY) |
24 #define HUGE_VALL ((long double)INFINITY) | 24 #define HUGE_VALL ((long double)INFINITY) |
25 | 25 |
26 #define MATH_ERRNO 1 | 26 #define MATH_ERRNO 1 |
27 #define MATH_ERREXCEPT 2 | 27 #define MATH_ERREXCEPT 2 |
28 #define math_errhandling 2 | 28 #define math_errhandling 2 |
29 | 29 |
30 #define FP_ILOGBNAN (-1-(int)(((unsigned)-1)>>1)) | 30 #define FP_ILOGBNAN (-1 - (int)(((unsigned)-1) >> 1)) |
31 #define FP_ILOGB0 FP_ILOGBNAN | 31 #define FP_ILOGB0 FP_ILOGBNAN |
32 | 32 |
33 #define FP_NAN 0 | 33 #define FP_NAN 0 |
34 #define FP_INFINITE 1 | 34 #define FP_INFINITE 1 |
35 #define FP_ZERO 2 | 35 #define FP_ZERO 2 |
36 #define FP_SUBNORMAL 3 | 36 #define FP_SUBNORMAL 3 |
37 #define FP_NORMAL 4 | 37 #define FP_NORMAL 4 |
38 | 38 |
39 int __fpclassify(double); | 39 int __fpclassify(double); |
40 int __fpclassifyf(float); | 40 int __fpclassifyf(float); |
41 int __fpclassifyl(long double); | 41 int __fpclassifyl(long double); |
42 | 42 |
43 static __inline unsigned __FLOAT_BITS(float __f) | 43 static __inline unsigned __FLOAT_BITS(float __f) { |
44 { | 44 union { |
45 » union {float __f; unsigned __i;} __u; | 45 float __f; |
46 » __u.__f = __f; | 46 unsigned __i; |
47 » return __u.__i; | 47 } __u; |
| 48 __u.__f = __f; |
| 49 return __u.__i; |
48 } | 50 } |
49 static __inline unsigned long long __DOUBLE_BITS(double __f) | 51 static __inline unsigned long long __DOUBLE_BITS(double __f) { |
50 { | 52 union { |
51 » union {double __f; unsigned long long __i;} __u; | 53 double __f; |
52 » __u.__f = __f; | 54 unsigned long long __i; |
53 » return __u.__i; | 55 } __u; |
| 56 __u.__f = __f; |
| 57 return __u.__i; |
54 } | 58 } |
55 | 59 |
56 #define fpclassify(x) ( \ | 60 #define fpclassify(x) \ |
57 » sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \ | 61 (sizeof(x) == sizeof(float) ? __fpclassifyf(x) : sizeof(x) == sizeof(double) \ |
58 » sizeof(x) == sizeof(double) ? __fpclassify(x) : \ | 62 ? __fpclassify(x) \ |
59 » __fpclassifyl(x) ) | 63 : __fpclassifyl(x)) |
60 | 64 |
61 #define isinf(x) ( \ | 65 #define isinf(x) \ |
62 » sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f80000
0 : \ | 66 (sizeof(x) == sizeof(float) \ |
63 » sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<
<52 : \ | 67 ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 \ |
64 » __fpclassifyl(x) == FP_INFINITE) | 68 : sizeof(x) == sizeof(double) \ |
| 69 ? (__DOUBLE_BITS(x) & -1ULL >> 1) == 0x7ffULL << 52 \ |
| 70 : __fpclassifyl(x) == FP_INFINITE) |
65 | 71 |
66 #define isnan(x) ( \ | 72 #define isnan(x) \ |
67 » sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000
: \ | 73 (sizeof(x) == sizeof(float) \ |
68 » sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<
52 : \ | 74 ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 \ |
69 » __fpclassifyl(x) == FP_NAN) | 75 : sizeof(x) == sizeof(double) \ |
| 76 ? (__DOUBLE_BITS(x) & -1ULL >> 1) > 0x7ffULL << 52 \ |
| 77 : __fpclassifyl(x) == FP_NAN) |
70 | 78 |
71 #define isnormal(x) ( \ | 79 #define isnormal(x) \ |
72 » sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff)
>= 0x01000000 : \ | 80 (sizeof(x) == sizeof(float) \ |
73 » sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1)
>= 1ULL<<53 : \ | 81 ? ((__FLOAT_BITS(x) + 0x00800000) & 0x7fffffff) >= 0x01000000 \ |
74 » __fpclassifyl(x) == FP_NORMAL) | 82 : sizeof(x) == sizeof(double) \ |
| 83 ? ((__DOUBLE_BITS(x) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53 \ |
| 84 : __fpclassifyl(x) == FP_NORMAL) |
75 | 85 |
76 #define isfinite(x) ( \ | 86 #define isfinite(x) \ |
77 » sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000
: \ | 87 (sizeof(x) == sizeof(float) \ |
78 » sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<
52 : \ | 88 ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 \ |
79 » __fpclassifyl(x) > FP_INFINITE) | 89 : sizeof(x) == sizeof(double) \ |
| 90 ? (__DOUBLE_BITS(x) & -1ULL >> 1) < 0x7ffULL << 52 \ |
| 91 : __fpclassifyl(x) > FP_INFINITE) |
80 | 92 |
81 int __signbit(double); | 93 int __signbit(double); |
82 int __signbitf(float); | 94 int __signbitf(float); |
83 int __signbitl(long double); | 95 int __signbitl(long double); |
84 | 96 |
85 #define signbit(x) ( \ | 97 #define signbit(x) \ |
86 » sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \ | 98 (sizeof(x) == sizeof(float) \ |
87 » sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \ | 99 ? (int)(__FLOAT_BITS(x) >> 31) \ |
88 » __signbitl(x) ) | 100 : sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x) >> 63) \ |
| 101 : __signbitl(x)) |
89 | 102 |
90 #define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y))) | 103 #define isunordered(x, y) (isnan((x)) ? ((void)(y), 1) : isnan((y))) |
91 | 104 |
92 #define __ISREL_DEF(rel, op, type) \ | 105 #define __ISREL_DEF(rel, op, type) \ |
93 static __inline int __is##rel(type __x, type __y) \ | 106 static __inline int __is##rel(type __x, type __y) { \ |
94 { return !isunordered(__x,__y) && __x op __y; } | 107 return !isunordered(__x, __y) && __x op __y; \ |
| 108 } |
95 | 109 |
96 __ISREL_DEF(lessf, <, float_t) | 110 __ISREL_DEF(lessf, <, float_t) |
97 __ISREL_DEF(less, <, double_t) | 111 __ISREL_DEF(less, <, double_t) |
98 __ISREL_DEF(lessl, <, long double) | 112 __ISREL_DEF(lessl, <, long double) |
99 __ISREL_DEF(lessequalf, <=, float_t) | 113 __ISREL_DEF(lessequalf, <=, float_t) |
100 __ISREL_DEF(lessequal, <=, double_t) | 114 __ISREL_DEF(lessequal, <=, double_t) |
101 __ISREL_DEF(lessequall, <=, long double) | 115 __ISREL_DEF(lessequall, <=, long double) |
102 __ISREL_DEF(lessgreaterf, !=, float_t) | 116 __ISREL_DEF(lessgreaterf, !=, float_t) |
103 __ISREL_DEF(lessgreater, !=, double_t) | 117 __ISREL_DEF(lessgreater, !=, double_t) |
104 __ISREL_DEF(lessgreaterl, !=, long double) | 118 __ISREL_DEF(lessgreaterl, !=, long double) |
105 __ISREL_DEF(greaterf, >, float_t) | 119 __ISREL_DEF(greaterf, >, float_t) |
106 __ISREL_DEF(greater, >, double_t) | 120 __ISREL_DEF(greater, >, double_t) |
107 __ISREL_DEF(greaterl, >, long double) | 121 __ISREL_DEF(greaterl, >, long double) |
108 __ISREL_DEF(greaterequalf, >=, float_t) | 122 __ISREL_DEF(greaterequalf, >=, float_t) |
109 __ISREL_DEF(greaterequal, >=, double_t) | 123 __ISREL_DEF(greaterequal, >=, double_t) |
110 __ISREL_DEF(greaterequall, >=, long double) | 124 __ISREL_DEF(greaterequall, >=, long double) |
111 | 125 |
112 #define __tg_pred_2(x, y, p) ( \ | 126 #define __tg_pred_2(x, y, p) \ |
113 » sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \ | 127 (sizeof((x) + (y)) == sizeof(float) \ |
114 » sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \ | 128 ? p##f(x, y) \ |
115 » p##l(x, y) ) | 129 : sizeof((x) + (y)) == sizeof(double) ? p(x, y) : p##l(x, y)) |
116 | 130 |
117 #define isless(x, y) __tg_pred_2(x, y, __isless) | 131 #define isless(x, y) __tg_pred_2(x, y, __isless) |
118 #define islessequal(x, y) __tg_pred_2(x, y, __islessequal) | 132 #define islessequal(x, y) __tg_pred_2(x, y, __islessequal) |
119 #define islessgreater(x, y) __tg_pred_2(x, y, __islessgreater) | 133 #define islessgreater(x, y) __tg_pred_2(x, y, __islessgreater) |
120 #define isgreater(x, y) __tg_pred_2(x, y, __isgreater) | 134 #define isgreater(x, y) __tg_pred_2(x, y, __isgreater) |
121 #define isgreaterequal(x, y) __tg_pred_2(x, y, __isgreaterequal) | 135 #define isgreaterequal(x, y) __tg_pred_2(x, y, __isgreaterequal) |
122 | 136 |
123 double acos(double); | 137 double acos(double); |
124 float acosf(float); | 138 float acosf(float); |
125 long double acosl(long double); | 139 long double acosl(long double); |
126 | 140 |
127 double acosh(double); | 141 double acosh(double); |
128 float acoshf(float); | 142 float acoshf(float); |
129 long double acoshl(long double); | 143 long double acoshl(long double); |
130 | 144 |
131 double asin(double); | 145 double asin(double); |
132 float asinf(float); | 146 float asinf(float); |
133 long double asinl(long double); | 147 long double asinl(long double); |
134 | 148 |
135 double asinh(double); | 149 double asinh(double); |
136 float asinhf(float); | 150 float asinhf(float); |
137 long double asinhl(long double); | 151 long double asinhl(long double); |
138 | 152 |
139 double atan(double); | 153 double atan(double); |
140 float atanf(float); | 154 float atanf(float); |
141 long double atanl(long double); | 155 long double atanl(long double); |
142 | 156 |
143 double atan2(double, double); | 157 double atan2(double, double); |
144 float atan2f(float, float); | 158 float atan2f(float, float); |
145 long double atan2l(long double, long double); | 159 long double atan2l(long double, long double); |
146 | 160 |
147 double atanh(double); | 161 double atanh(double); |
148 float atanhf(float); | 162 float atanhf(float); |
149 long double atanhl(long double); | 163 long double atanhl(long double); |
150 | 164 |
151 double cbrt(double); | 165 double cbrt(double); |
152 float cbrtf(float); | 166 float cbrtf(float); |
153 long double cbrtl(long double); | 167 long double cbrtl(long double); |
154 | 168 |
155 double ceil(double); | 169 double ceil(double); |
156 float ceilf(float); | 170 float ceilf(float); |
157 long double ceill(long double); | 171 long double ceill(long double); |
158 | 172 |
159 double copysign(double, double); | 173 double copysign(double, double); |
160 float copysignf(float, float); | 174 float copysignf(float, float); |
161 long double copysignl(long double, long double); | 175 long double copysignl(long double, long double); |
162 | 176 |
163 double cos(double); | 177 double cos(double); |
164 float cosf(float); | 178 float cosf(float); |
165 long double cosl(long double); | 179 long double cosl(long double); |
166 | 180 |
167 double cosh(double); | 181 double cosh(double); |
168 float coshf(float); | 182 float coshf(float); |
169 long double coshl(long double); | 183 long double coshl(long double); |
170 | 184 |
171 double erf(double); | 185 double erf(double); |
172 float erff(float); | 186 float erff(float); |
173 long double erfl(long double); | 187 long double erfl(long double); |
174 | 188 |
175 double erfc(double); | 189 double erfc(double); |
176 float erfcf(float); | 190 float erfcf(float); |
177 long double erfcl(long double); | 191 long double erfcl(long double); |
178 | 192 |
179 double exp(double); | 193 double exp(double); |
180 float expf(float); | 194 float expf(float); |
181 long double expl(long double); | 195 long double expl(long double); |
182 | 196 |
183 double exp2(double); | 197 double exp2(double); |
184 float exp2f(float); | 198 float exp2f(float); |
185 long double exp2l(long double); | 199 long double exp2l(long double); |
186 | 200 |
187 double expm1(double); | 201 double expm1(double); |
188 float expm1f(float); | 202 float expm1f(float); |
189 long double expm1l(long double); | 203 long double expm1l(long double); |
190 | 204 |
191 double fabs(double); | 205 double fabs(double); |
192 float fabsf(float); | 206 float fabsf(float); |
193 long double fabsl(long double); | 207 long double fabsl(long double); |
194 | 208 |
195 double fdim(double, double); | 209 double fdim(double, double); |
196 float fdimf(float, float); | 210 float fdimf(float, float); |
197 long double fdiml(long double, long double); | 211 long double fdiml(long double, long double); |
198 | 212 |
199 double floor(double); | 213 double floor(double); |
200 float floorf(float); | 214 float floorf(float); |
201 long double floorl(long double); | 215 long double floorl(long double); |
202 | 216 |
203 double fma(double, double, double); | 217 double fma(double, double, double); |
204 float fmaf(float, float, float); | 218 float fmaf(float, float, float); |
205 long double fmal(long double, long double, long double); | 219 long double fmal(long double, long double, long double); |
206 | 220 |
207 double fmax(double, double); | 221 double fmax(double, double); |
208 float fmaxf(float, float); | 222 float fmaxf(float, float); |
209 long double fmaxl(long double, long double); | 223 long double fmaxl(long double, long double); |
210 | 224 |
211 double fmin(double, double); | 225 double fmin(double, double); |
212 float fminf(float, float); | 226 float fminf(float, float); |
213 long double fminl(long double, long double); | 227 long double fminl(long double, long double); |
214 | 228 |
215 double fmod(double, double); | 229 double fmod(double, double); |
216 float fmodf(float, float); | 230 float fmodf(float, float); |
217 long double fmodl(long double, long double); | 231 long double fmodl(long double, long double); |
218 | 232 |
219 double frexp(double, int *); | 233 double frexp(double, int*); |
220 float frexpf(float, int *); | 234 float frexpf(float, int*); |
221 long double frexpl(long double, int *); | 235 long double frexpl(long double, int*); |
222 | 236 |
223 double hypot(double, double); | 237 double hypot(double, double); |
224 float hypotf(float, float); | 238 float hypotf(float, float); |
225 long double hypotl(long double, long double); | 239 long double hypotl(long double, long double); |
226 | 240 |
227 int ilogb(double); | 241 int ilogb(double); |
228 int ilogbf(float); | 242 int ilogbf(float); |
229 int ilogbl(long double); | 243 int ilogbl(long double); |
230 | 244 |
231 double ldexp(double, int); | 245 double ldexp(double, int); |
232 float ldexpf(float, int); | 246 float ldexpf(float, int); |
233 long double ldexpl(long double, int); | 247 long double ldexpl(long double, int); |
234 | 248 |
235 double lgamma(double); | 249 double lgamma(double); |
236 float lgammaf(float); | 250 float lgammaf(float); |
237 long double lgammal(long double); | 251 long double lgammal(long double); |
238 | 252 |
239 long long llrint(double); | 253 long long llrint(double); |
240 long long llrintf(float); | 254 long long llrintf(float); |
241 long long llrintl(long double); | 255 long long llrintl(long double); |
242 | 256 |
243 long long llround(double); | 257 long long llround(double); |
244 long long llroundf(float); | 258 long long llroundf(float); |
245 long long llroundl(long double); | 259 long long llroundl(long double); |
246 | 260 |
247 double log(double); | 261 double log(double); |
248 float logf(float); | 262 float logf(float); |
249 long double logl(long double); | 263 long double logl(long double); |
250 | 264 |
251 double log10(double); | 265 double log10(double); |
252 float log10f(float); | 266 float log10f(float); |
253 long double log10l(long double); | 267 long double log10l(long double); |
254 | 268 |
255 double log1p(double); | 269 double log1p(double); |
256 float log1pf(float); | 270 float log1pf(float); |
257 long double log1pl(long double); | 271 long double log1pl(long double); |
258 | 272 |
259 double log2(double); | 273 double log2(double); |
260 float log2f(float); | 274 float log2f(float); |
261 long double log2l(long double); | 275 long double log2l(long double); |
262 | 276 |
263 double logb(double); | 277 double logb(double); |
264 float logbf(float); | 278 float logbf(float); |
265 long double logbl(long double); | 279 long double logbl(long double); |
266 | 280 |
267 long lrint(double); | 281 long lrint(double); |
268 long lrintf(float); | 282 long lrintf(float); |
269 long lrintl(long double); | 283 long lrintl(long double); |
270 | 284 |
271 long lround(double); | 285 long lround(double); |
272 long lroundf(float); | 286 long lroundf(float); |
273 long lroundl(long double); | 287 long lroundl(long double); |
274 | 288 |
275 double modf(double, double *); | 289 double modf(double, double*); |
276 float modff(float, float *); | 290 float modff(float, float*); |
277 long double modfl(long double, long double *); | 291 long double modfl(long double, long double*); |
278 | 292 |
279 double nan(const char *); | 293 double nan(const char*); |
280 float nanf(const char *); | 294 float nanf(const char*); |
281 long double nanl(const char *); | 295 long double nanl(const char*); |
282 | 296 |
283 double nearbyint(double); | 297 double nearbyint(double); |
284 float nearbyintf(float); | 298 float nearbyintf(float); |
285 long double nearbyintl(long double); | 299 long double nearbyintl(long double); |
286 | 300 |
287 double nextafter(double, double); | 301 double nextafter(double, double); |
288 float nextafterf(float, float); | 302 float nextafterf(float, float); |
289 long double nextafterl(long double, long double); | 303 long double nextafterl(long double, long double); |
290 | 304 |
291 double nexttoward(double, long double); | 305 double nexttoward(double, long double); |
292 float nexttowardf(float, long double); | 306 float nexttowardf(float, long double); |
293 long double nexttowardl(long double, long double); | 307 long double nexttowardl(long double, long double); |
294 | 308 |
295 double pow(double, double); | 309 double pow(double, double); |
296 float powf(float, float); | 310 float powf(float, float); |
297 long double powl(long double, long double); | 311 long double powl(long double, long double); |
298 | 312 |
299 double remainder(double, double); | 313 double remainder(double, double); |
300 float remainderf(float, float); | 314 float remainderf(float, float); |
301 long double remainderl(long double, long double); | 315 long double remainderl(long double, long double); |
302 | 316 |
303 double remquo(double, double, int *); | 317 double remquo(double, double, int*); |
304 float remquof(float, float, int *); | 318 float remquof(float, float, int*); |
305 long double remquol(long double, long double, int *); | 319 long double remquol(long double, long double, int*); |
306 | 320 |
307 double rint(double); | 321 double rint(double); |
308 float rintf(float); | 322 float rintf(float); |
309 long double rintl(long double); | 323 long double rintl(long double); |
310 | 324 |
311 double round(double); | 325 double round(double); |
312 float roundf(float); | 326 float roundf(float); |
313 long double roundl(long double); | 327 long double roundl(long double); |
314 | 328 |
315 double scalbln(double, long); | 329 double scalbln(double, long); |
316 float scalblnf(float, long); | 330 float scalblnf(float, long); |
317 long double scalblnl(long double, long); | 331 long double scalblnl(long double, long); |
318 | 332 |
319 double scalbn(double, int); | 333 double scalbn(double, int); |
320 float scalbnf(float, int); | 334 float scalbnf(float, int); |
321 long double scalbnl(long double, int); | 335 long double scalbnl(long double, int); |
322 | 336 |
323 double sin(double); | 337 double sin(double); |
324 float sinf(float); | 338 float sinf(float); |
325 long double sinl(long double); | 339 long double sinl(long double); |
326 | 340 |
327 double sinh(double); | 341 double sinh(double); |
328 float sinhf(float); | 342 float sinhf(float); |
329 long double sinhl(long double); | 343 long double sinhl(long double); |
330 | 344 |
331 double sqrt(double); | 345 double sqrt(double); |
332 float sqrtf(float); | 346 float sqrtf(float); |
333 long double sqrtl(long double); | 347 long double sqrtl(long double); |
334 | 348 |
335 double tan(double); | 349 double tan(double); |
336 float tanf(float); | 350 float tanf(float); |
337 long double tanl(long double); | 351 long double tanl(long double); |
338 | 352 |
339 double tanh(double); | 353 double tanh(double); |
340 float tanhf(float); | 354 float tanhf(float); |
341 long double tanhl(long double); | 355 long double tanhl(long double); |
342 | 356 |
343 double tgamma(double); | 357 double tgamma(double); |
344 float tgammaf(float); | 358 float tgammaf(float); |
345 long double tgammal(long double); | 359 long double tgammal(long double); |
346 | 360 |
347 double trunc(double); | 361 double trunc(double); |
348 float truncf(float); | 362 float truncf(float); |
349 long double truncl(long double); | 363 long double truncl(long double); |
350 | 364 |
351 | |
352 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) | 365 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) |
353 #undef MAXFLOAT | 366 #undef MAXFLOAT |
354 #define MAXFLOAT 3.40282346638528859812e+38F | 367 #define MAXFLOAT 3.40282346638528859812e+38F |
355 #endif | 368 #endif |
356 | 369 |
357 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | 370 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
358 #define M_E 2.7182818284590452354 /* e */ | 371 #define M_E 2.7182818284590452354 /* e */ |
359 #define M_LOG2E 1.4426950408889634074 /* log_2 e */ | 372 #define M_LOG2E 1.4426950408889634074 /* log_2 e */ |
360 #define M_LOG10E 0.43429448190325182765 /* log_10 e */ | 373 #define M_LOG10E 0.43429448190325182765 /* log_10 e */ |
361 #define M_LN2 0.69314718055994530942 /* log_e 2 */ | 374 #define M_LN2 0.69314718055994530942 /* log_e 2 */ |
362 #define M_LN10 2.30258509299404568402 /* log_e 10 */ | 375 #define M_LN10 2.30258509299404568402 /* log_e 10 */ |
363 #define M_PI 3.14159265358979323846 /* pi */ | 376 #define M_PI 3.14159265358979323846 /* pi */ |
364 #define M_PI_2 1.57079632679489661923 /* pi/2 */ | 377 #define M_PI_2 1.57079632679489661923 /* pi/2 */ |
365 #define M_PI_4 0.78539816339744830962 /* pi/4 */ | 378 #define M_PI_4 0.78539816339744830962 /* pi/4 */ |
366 #define M_1_PI 0.31830988618379067154 /* 1/pi */ | 379 #define M_1_PI 0.31830988618379067154 /* 1/pi */ |
367 #define M_2_PI 0.63661977236758134308 /* 2/pi */ | 380 #define M_2_PI 0.63661977236758134308 /* 2/pi */ |
368 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ | 381 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ |
369 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ | 382 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ |
370 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ | 383 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ |
371 | 384 |
372 extern int signgam; | 385 extern int signgam; |
373 | 386 |
374 double j0(double); | 387 double j0(double); |
375 double j1(double); | 388 double j1(double); |
376 double jn(int, double); | 389 double jn(int, double); |
377 | 390 |
378 double y0(double); | 391 double y0(double); |
379 double y1(double); | 392 double y1(double); |
380 double yn(int, double); | 393 double yn(int, double); |
381 #endif | 394 #endif |
382 | 395 |
383 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | 396 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
384 #define HUGE 3.40282346638528859812e+38F | 397 #define HUGE 3.40282346638528859812e+38F |
385 | 398 |
386 double drem(double, double); | 399 double drem(double, double); |
387 float dremf(float, float); | 400 float dremf(float, float); |
388 | 401 |
389 int finite(double); | 402 int finite(double); |
390 int finitef(float); | 403 int finitef(float); |
391 | 404 |
392 double scalb(double, double); | 405 double scalb(double, double); |
393 float scalbf(float, float); | 406 float scalbf(float, float); |
394 | 407 |
395 double significand(double); | 408 double significand(double); |
396 float significandf(float); | 409 float significandf(float); |
397 | 410 |
398 double lgamma_r(double, int*); | 411 double lgamma_r(double, int*); |
399 float lgammaf_r(float, int*); | 412 float lgammaf_r(float, int*); |
400 | 413 |
401 float j0f(float); | 414 float j0f(float); |
402 float j1f(float); | 415 float j1f(float); |
403 float jnf(int, float); | 416 float jnf(int, float); |
404 | 417 |
405 float y0f(float); | 418 float y0f(float); |
406 float y1f(float); | 419 float y1f(float); |
407 float ynf(int, float); | 420 float ynf(int, float); |
408 #endif | 421 #endif |
409 | 422 |
410 #ifdef _GNU_SOURCE | 423 #ifdef _GNU_SOURCE |
411 long double lgammal_r(long double, int*); | 424 long double lgammal_r(long double, int*); |
412 | 425 |
413 void sincos(double, double*, double*); | 426 void sincos(double, double*, double*); |
414 void sincosf(float, float*, float*); | 427 void sincosf(float, float*, float*); |
415 void sincosl(long double, long double*, long double*); | 428 void sincosl(long double, long double*, long double*); |
416 | 429 |
417 double exp10(double); | 430 double exp10(double); |
418 float exp10f(float); | 431 float exp10f(float); |
419 long double exp10l(long double); | 432 long double exp10l(long double); |
420 | 433 |
421 double pow10(double); | 434 double pow10(double); |
422 float pow10f(float); | 435 float pow10f(float); |
423 long double pow10l(long double); | 436 long double pow10l(long double); |
424 #endif | 437 #endif |
425 | 438 |
426 #ifdef __cplusplus | 439 #ifdef __cplusplus |
427 } | 440 } |
428 #endif | 441 #endif |
429 | 442 |
430 #endif | 443 #endif |
OLD | NEW |