Index: src/IceUtils.h |
diff --git a/src/IceUtils.h b/src/IceUtils.h |
index 9387671fa21b5a54e6cf9d5b654dbd1b6b0fd89a..0080a11b87f051691f176f0cef4aa3dc6a8b4955 100644 |
--- a/src/IceUtils.h |
+++ b/src/IceUtils.h |
@@ -16,6 +16,7 @@ |
#define SUBZERO_SRC_ICEUTILS_H |
#include <climits> |
+#include <cmath> // std::signbit() |
namespace Ice { |
@@ -117,6 +118,13 @@ public: |
return value; |
return (value >> shift) | (value << (32 - shift)); |
} |
+ |
+ /// Returns true if Val is +0.0. It requires T to be a floating point type. |
+ template <typename T> static bool isPositiveZero(T Val) { |
+ static_assert(std::is_floating_point<T>::value, |
+ "Input type must be floating point"); |
+ return Val == 0 && !std::signbit(Val); |
+ } |
}; |
} // end of namespace Ice |