summaryrefslogtreecommitdiff
path: root/src/tgmath/__tgmath.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tgmath/__tgmath.h')
-rw-r--r--src/tgmath/__tgmath.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tgmath/__tgmath.h b/src/tgmath/__tgmath.h
new file mode 100644
index 00000000..b4e5c5ac
--- /dev/null
+++ b/src/tgmath/__tgmath.h
@@ -0,0 +1,17 @@
+/* Implementation details */
+#include <math.h>
+#include <complex.h>
+
+#if __STDC_VERSION__ >= 20110101L
+#define __tg(fn, x) _Generic((x), long double: fn##l, \
+ float: fn##f, \
+ default: fn)(x)
+#else
+#define __tg(fn, x) (sizeof(x) == sizeof(long double) ? fn##l(x) : \
+ (sizeof(x) == sizeof(float) ? fn##f(x) : \
+ fn(x)))
+#endif
+
+#define cos(x) __tg(cos, x)
+
+/*c 99:??;tgmath.h c*/