X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=include%2Fmath.h;h=9c5f06e7b6e7830c0c21dc5d5a9e2a6d7e0c72b7;hp=fffdf4f7dcb8adf9e26ff34eea9a2b80053810c0;hb=5e9314ff03076a94316d4e66efd082548c065f3d;hpb=74eea628cf43355ba2b227f0bb3c31697d637761 diff --git a/include/math.h b/include/math.h index fffdf4f7..9c5f06e7 100644 --- a/include/math.h +++ b/include/math.h @@ -1,6 +1,10 @@ #ifndef _MATH_H #define _MATH_H +#ifdef __cplusplus +extern "C" { +#endif + #define __NEED___uint16_t #define __NEED___uint32_t #define __NEED___uint64_t @@ -44,6 +48,24 @@ int __fpclassifyl(long double); #define isnormal(x) (fpclassify(x) == FP_NORMAL) #define isfinite(x) (fpclassify(x) > FP_INFINITE) +#define isunordered(x,y) (isnan((x)) ? ((y),1) : isnan((y))) + +static inline int __isrel(long double __x, long double __y, int __rel) +{ + if (isunordered(__x, __y)) return 0; + if (__rel==-2) return __x < __y; + if (__rel==2) return __x > __y; + if (__rel==-1) return __x <= __y; + if (__rel==1) return __x >= __y; + return __x != __y; +} + +#define isless(x,y) __isrel((x), (y), -2) +#define islessequal(x,y) __isrel((x), (y), -1) +#define islessgreater(x,y) __isrel((x), (y), 0) +#define isgreaterequal(x,y) __isrel((x), (y), 1) +#define isgreater(x,y) __isrel((x), (y), 2) + double acos(double); float acosf(float); long double acosl(long double); @@ -299,4 +321,8 @@ extern int signgam; double scalb(double, double); #endif +#ifdef __cplusplus +} +#endif + #endif