summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-07-02 22:38:41 -0400
committerErik Schnetter <schnetter@gmail.com>2013-07-02 22:38:41 -0400
commit440d92f0a53e0d09773f4a1ee796bc835e1ec9dc (patch)
tree99bcc18de4d6c27e56766e67526d7ecdd98a9bf8
parent342fc114706525b45807abace10f7fd09d43b195 (diff)
downloadvecmathlib-440d92f0a53e0d09773f4a1ee796bc835e1ec9dc.zip
vecmathlib-440d92f0a53e0d09773f4a1ee796bc835e1ec9dc.tar.gz
Choose FP conformance settings automatically depending on fast-math
-rw-r--r--vecmathlib.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/vecmathlib.h b/vecmathlib.h
index aa81110..7818b26 100644
--- a/vecmathlib.h
+++ b/vecmathlib.h
@@ -12,11 +12,9 @@
# define VML_DEBUG
#endif
-#undef VML_HAVE_DENORMALS
-#undef VML_HAVE_FP_CONTRACT // see below
-#undef VML_HAVE_INF
-#undef VML_HAVE_NAN
-#define VML_HAVE_SIGNED_ZERO
+
+
+// FP settings
// Possible effects of not having VML_HAVE_FP_CONTRACT:
// - can re-associate
@@ -24,6 +22,25 @@
// - can break ties differently when rounding (?)
// - can evaluate functions with reduced precision (80% of significant digits)
+// default settings
+#define VML_HAVE_DENORMALS
+#define VML_HAVE_FP_CONTRACT
+#define VML_HAVE_INF
+#define VML_HAVE_NAN
+#define VML_HAVE_SIGNED_ZERO
+
+// optimized settings
+#ifdef __FAST_MATH__
+# undef VML_HAVE_DENORMALS
+# undef VML_HAVE_FP_CONTRACT
+# undef VML_HAVE_INF
+# undef VML_HAVE_NAN
+#endif
+
+#warning "TODO: introduce mad, as fast version of fma"
+#warning "TODO: introduce ieee_isnan and friends"
+#warning "TODO: switch between isnan and ieee_isnan at an outside level"
+
// This workaround is needed for older libstdc++ versions such as the
OpenPOWER on IntegriCloud