summaryrefslogtreecommitdiff
path: root/src/math/signbit.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/signbit.h')
-rw-r--r--src/math/signbit.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/math/signbit.h b/src/math/signbit.h
new file mode 100644
index 00000000..77cc3977
--- /dev/null
+++ b/src/math/signbit.h
@@ -0,0 +1,23 @@
+#include <math.h>
+
+#define signbit(__x) \
+ (sizeof(__x) == sizeof(long double) ? \
+ ((((union { \
+ long double __f; \
+ char __c[sizeof(__x)]; \
+ }){.__f = (__x)}).__c[sizeof(__x)-1] & 0x80) == 0x80 ? 1 : 0) : \
+ sizeof(__x) == sizeof(double) ? \
+ ((((union { \
+ double __f; \
+ char __c[sizeof(__x)]; \
+ }){.__f = (__x)}).__c[sizeof(__x)-1] & 0x80) == 0x80 ? 1 : 0) : \
+ (((union { \
+ float __f; \
+ char __c[sizeof(__x)]; \
+ }){.__f = (__x)}).__c[sizeof(__x)-1] & 0x80) == 0x80 ? 1 : 0)
+
+
+/*
+STDC(199901)
+LINK(m)
+*/