[Libclc-dev] [PATCH] Add floating-point macro definitions v2

Tom Stellard tom at stellard.net
Thu Dec 19 18:09:15 PST 2013


From: Tom Stellard <thomas.stellard at amd.com>

v2:
  - Fix typo.
---
 generic/include/clc/clc.h               |  3 +++
 generic/include/clc/float/definitions.h | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 generic/include/clc/float/definitions.h

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 8f0dbd3..d07c8b5 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -62,6 +62,9 @@
 #include <clc/math/native_sqrt.h>
 #include <clc/math/rsqrt.h>
 
+/* 6.11.2.1 Floating-point macros */
+#include <clc/float/definitions.h>
+
 /* 6.11.3 Integer Functions */
 #include <clc/integer/abs.h>
 #include <clc/integer/abs_diff.h>
diff --git a/generic/include/clc/float/definitions.h b/generic/include/clc/float/definitions.h
new file mode 100644
index 0000000..e6ef1d8
--- /dev/null
+++ b/generic/include/clc/float/definitions.h
@@ -0,0 +1,24 @@
+#define FLT_DIG 	6
+#define FLT_MANT_DIG 	24
+#define FLT_MAX_10_EXP 	+38
+#define FLT_MAX_EXP 	+128
+#define FLT_MIN_10_EXP 	-37
+#define FLT_MIN_EXP 	-125
+#define FLT_RADIX 	2
+#define FLT_MAX 	0x1.fffffep127f
+#define FLT_MIN 	0x1.0p-126f
+#define FLT_EPSILON 	0x1.0p-23f
+
+#ifdef cl_khr_fp64
+
+#define DBL_DIG 	15
+#define DBL_MANT_DIG 	53
+#define DBL_MAX_10_EXP 	+308
+#define DBL_MAX_EXP 	+1024
+#define DBL_MIN_10_EXP 	-307
+#define DBL_MIN_EXP 	-1021
+#define DBL_MAX 	0x1.fffffffffffffp1023
+#define DBL_MIN 	0x1.0p-1022
+#define DBL_EPSILON 	0x1.0p-52
+
+#endif
-- 
1.8.1.4





More information about the Libclc-dev mailing list