10 #define __NEED_float_t
11 #define __NEED_double_t
12 #include <bits/alltypes.h>
14 #if 100*__GNUC__+__GNUC_MINOR__ >= 303
15 #define NAN __builtin_nanf("")
16 #define INFINITY __builtin_inff()
18 #define NAN (0.0f/0.0f)
19 #define INFINITY 1e5000f
22 #define HUGE_VALF INFINITY
23 #define HUGE_VAL ((double)INFINITY)
24 #define HUGE_VALL ((long double)INFINITY)
27 #define MATH_ERREXCEPT 2
28 #define math_errhandling 2
30 #define FP_ILOGBNAN (-1-(int)(((unsigned)-1)>>1))
31 #define FP_ILOGB0 FP_ILOGBNAN
36 #define FP_SUBNORMAL 3
39 int __fpclassify(double);
40 int __fpclassifyf(float);
41 int __fpclassifyl(long double);
43 static __inline
unsigned __FLOAT_BITS(float __f
)
45 union {float __f
; unsigned __i
;} __u
;
49 static __inline
unsigned long long __DOUBLE_BITS(double __f
)
51 union {double __f
; unsigned long long __i
;} __u
;
56 #define fpclassify(x) ( \
57 sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \
58 sizeof(x) == sizeof(double) ? __fpclassify(x) : \
62 sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \
63 sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \
64 __fpclassifyl(x) == FP_INFINITE)
67 sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \
68 sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \
69 __fpclassifyl(x) == FP_NAN)
71 #define isnormal(x) ( \
72 sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \
73 sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \
74 __fpclassifyl(x) == FP_NORMAL)
76 #define isfinite(x) ( \
77 sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \
78 sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \
79 __fpclassifyl(x) > FP_INFINITE)
81 int __signbit(double);
82 int __signbitf(float);
83 int __signbitl(long double);
85 #define signbit(x) ( \
86 sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \
87 sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \
90 #define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y)))
92 #define __ISREL_DEF(rel, op, type) \
93 static __inline int __is##rel(type __x, type __y) \
94 { return !isunordered(__x,__y) && __x op __y; }
96 __ISREL_DEF(lessf
, <, float_t
)
97 __ISREL_DEF(less
, <, double_t
)
98 __ISREL_DEF(lessl
, <, long double)
99 __ISREL_DEF(lessequalf
, <=, float_t
)
100 __ISREL_DEF(lessequal
, <=, double_t
)
101 __ISREL_DEF(lessequall
, <=, long double)
102 __ISREL_DEF(lessgreaterf
, !=, float_t
)
103 __ISREL_DEF(lessgreater
, !=, double_t
)
104 __ISREL_DEF(lessgreaterl
, !=, long double)
105 __ISREL_DEF(greaterf
, >, float_t
)
106 __ISREL_DEF(greater
, >, double_t
)
107 __ISREL_DEF(greaterl
, >, long double)
108 __ISREL_DEF(greaterequalf
, >=, float_t
)
109 __ISREL_DEF(greaterequal
, >=, double_t
)
110 __ISREL_DEF(greaterequall
, >=, long double)
112 #define __tg_pred_2(x, y, p) ( \
113 sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \
114 sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \
117 #define isless(x, y) __tg_pred_2(x, y, __isless)
118 #define islessequal(x, y) __tg_pred_2(x, y, __islessequal)
119 #define islessgreater(x, y) __tg_pred_2(x, y, __islessgreater)
120 #define isgreater(x, y) __tg_pred_2(x, y, __isgreater)
121 #define isgreaterequal(x, y) __tg_pred_2(x, y, __isgreaterequal)
125 long double acosl(long double);
127 double acosh(double);
129 long double acoshl(long double);
133 long double asinl(long double);
135 double asinh(double);
137 long double asinhl(long double);
141 long double atanl(long double);
143 double atan2(double, double);
144 float atan2f(float, float);
145 long double atan2l(long double, long double);
147 double atanh(double);
149 long double atanhl(long double);
153 long double cbrtl(long double);
157 long double ceill(long double);
159 double copysign(double, double);
160 float copysignf(float, float);
161 long double copysignl(long double, long double);
165 long double cosl(long double);
169 long double coshl(long double);
173 long double erfl(long double);
177 long double erfcl(long double);
181 long double expl(long double);
185 long double exp2l(long double);
187 double expm1(double);
189 long double expm1l(long double);
193 long double fabsl(long double);
195 double fdim(double, double);
196 float fdimf(float, float);
197 long double fdiml(long double, long double);
199 double floor(double);
201 long double floorl(long double);
203 double fma(double, double, double);
204 float fmaf(float, float, float);
205 long double fmal(long double, long double, long double);
207 double fmax(double, double);
208 float fmaxf(float, float);
209 long double fmaxl(long double, long double);
211 double fmin(double, double);
212 float fminf(float, float);
213 long double fminl(long double, long double);
215 double fmod(double, double);
216 float fmodf(float, float);
217 long double fmodl(long double, long double);
219 double frexp(double, int *);
220 float frexpf(float, int *);
221 long double frexpl(long double, int *);
223 double hypot(double, double);
224 float hypotf(float, float);
225 long double hypotl(long double, long double);
229 int ilogbl(long double);
231 double ldexp(double, int);
232 float ldexpf(float, int);
233 long double ldexpl(long double, int);
235 double lgamma(double);
236 float lgammaf(float);
237 long double lgammal(long double);
239 long long llrint(double);
240 long long llrintf(float);
241 long long llrintl(long double);
243 long long llround(double);
244 long long llroundf(float);
245 long long llroundl(long double);
249 long double logl(long double);
251 double log10(double);
253 long double log10l(long double);
255 double log1p(double);
257 long double log1pl(long double);
261 long double log2l(long double);
265 long double logbl(long double);
269 long lrintl(long double);
273 long lroundl(long double);
275 double modf(double, double *);
276 float modff(float, float *);
277 long double modfl(long double, long double *);
279 double nan(const char *);
280 float nanf(const char *);
281 long double nanl(const char *);
283 double nearbyint(double);
284 float nearbyintf(float);
285 long double nearbyintl(long double);
287 double nextafter(double, double);
288 float nextafterf(float, float);
289 long double nextafterl(long double, long double);
291 double nexttoward(double, long double);
292 float nexttowardf(float, long double);
293 long double nexttowardl(long double, long double);
295 double pow(double, double);
296 float powf(float, float);
297 long double powl(long double, long double);
299 double remainder(double, double);
300 float remainderf(float, float);
301 long double remainderl(long double, long double);
303 double remquo(double, double, int *);
304 float remquof(float, float, int *);
305 long double remquol(long double, long double, int *);
309 long double rintl(long double);
311 double round(double);
313 long double roundl(long double);
315 double scalbln(double, long);
316 float scalblnf(float, long);
317 long double scalblnl(long double, long);
319 double scalbn(double, int);
320 float scalbnf(float, int);
321 long double scalbnl(long double, int);
325 long double sinl(long double);
329 long double sinhl(long double);
333 long double sqrtl(long double);
337 long double tanl(long double);
341 long double tanhl(long double);
343 double tgamma(double);
344 float tgammaf(float);
345 long double tgammal(long double);
347 double trunc(double);
349 long double truncl(long double);
352 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE)
354 #define MAXFLOAT 3.40282346638528859812e+38F
357 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
358 #define M_E 2.7182818284590452354 /* e */
359 #define M_LOG2E 1.4426950408889634074 /* log_2 e */
360 #define M_LOG10E 0.43429448190325182765 /* log_10 e */
361 #define M_LN2 0.69314718055994530942 /* log_e 2 */
362 #define M_LN10 2.30258509299404568402 /* log_e 10 */
363 #define M_PI 3.14159265358979323846 /* pi */
364 #define M_PI_2 1.57079632679489661923 /* pi/2 */
365 #define M_PI_4 0.78539816339744830962 /* pi/4 */
366 #define M_1_PI 0.31830988618379067154 /* 1/pi */
367 #define M_2_PI 0.63661977236758134308 /* 2/pi */
368 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
369 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
370 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
376 double jn(int, double);
380 double yn(int, double);
383 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
384 #define HUGE 3.40282346638528859812e+38F
386 double drem(double, double);
387 float dremf(float, float);
392 double scalb(double, double);
393 float scalbf(float, float);
395 double significand(double);
396 float significandf(float);
398 double lgamma_r(double, int*);
399 float lgammaf_r(float, int*);
403 float jnf(int, float);
407 float ynf(int, float);
411 long double lgammal_r(long double, int*);
413 void sincos(double, double*, double*);
414 void sincosf(float, float*, float*);
415 void sincosl(long double, long double*, long double*);
417 double exp10(double);
419 long double exp10l(long double);
421 double pow10(double);
423 long double pow10l(long double);