LibC: math.h defines is*() macros and uses builtins for values

This commit is contained in:
Bananymous 2023-08-16 10:41:55 +03:00
parent 5806a6484f
commit bf02330db9
1 changed files with 19 additions and 20 deletions

View File

@ -22,21 +22,20 @@ __BEGIN_DECLS
typedef long double double_t; typedef long double double_t;
#endif #endif
// FIXME: define these // FIXME: define this
#if 0 // int fpclassify(real-floating x);
int fpclassify(real-floating x);
int isfinite(real-floating x); #define isfinite(x) __builtin_isfinite(x)
int isgreater(real-floating x, real-floating y); #define isgreater(x, y) __builtin_isgreater(x, y)
int isgreaterequal(real-floating x, real-floating y); #define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
int isinf(real-floating x); #define isinf(x) __builtin_isinf_sign(x)
int isless(real-floating x, real-floating y); #define isless(x, y) __builtin_isless(x, y)
int islessequal(real-floating x, real-floating y); #define islessequal(x, y) __builtin_islessequal(x, y)
int islessgreater(real-floating x, real-floating y); #define islessgreater(x, y) __builtin_islessgreater(x, y)
int isnan(real-floating x); #define isnan(x) __builtin_isnan(x)
int isnormal(real-floating x); #define isnormal(x) __builtin_isnormal(x)
int isunordered(real-floating x, real-floating y); #define isunordered(x, y) __builtin_isunordered(x, y)
int signbit(real-floating x); #define signbit(x) __builtin_signbit(x)
#endif
#define M_E 2.7182818284590452354 #define M_E 2.7182818284590452354
#define M_LOG2E 1.4426950408889634074 #define M_LOG2E 1.4426950408889634074
@ -52,11 +51,11 @@ int signbit(real-floating x);
#define M_SQRT2 1.41421356237309504880 #define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.70710678118654752440 #define M_SQRT1_2 0.70710678118654752440
#define HUGE_VAL 1e10000 #define HUGE_VAL __builtin_huge_val()
#define HUGE_VALF 1e10000f #define HUGE_VALF __builtin_huge_valf()
#define HUGE_VALL 1e10000L #define HUGE_VALL __builtin_huge_vall()
#define INFINITY HUGE_VALF #define INFINITY __builtin_inff()
#define NAN (0.0f / 0.0f) #define NAN __builtin_nanf("")
#define FP_INFINITE 0 #define FP_INFINITE 0
#define FP_NAN 1 #define FP_NAN 1