summaryrefslogtreecommitdiffhomepage
path: root/opentrack/nan.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack/nan.cpp')
-rw-r--r--opentrack/nan.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/opentrack/nan.cpp b/opentrack/nan.cpp
new file mode 100644
index 00000000..2522ba38
--- /dev/null
+++ b/opentrack/nan.cpp
@@ -0,0 +1,16 @@
+#include <cmath>
+
+#if defined(__GNUC__)
+bool __attribute__ ((noinline)) nanp(double value)
+#elif defined(_WIN32)
+__declspec(noinline) bool nanp(double value)
+#else
+bool nanp(double value)
+#endif
+{
+ using std::isnan;
+ using std::isinf;
+
+ const volatile double x = value;
+ return isnan(x) || isinf(x);
+} \ No newline at end of file