Index: src/IceUtils.h |
diff --git a/src/IceUtils.h b/src/IceUtils.h |
index 9387671fa21b5a54e6cf9d5b654dbd1b6b0fd89a..cfe9a353ae4ed3b81b473f621159acf7104b3a11 100644 |
--- a/src/IceUtils.h |
+++ b/src/IceUtils.h |
@@ -16,6 +16,7 @@ |
#define SUBZERO_SRC_ICEUTILS_H |
#include <climits> |
+#include <cmath> // 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 && !signbit(Val); |
Jim Stichnoth
2015/11/17 04:00:36
std::signbit
John
2015/11/17 22:17:05
Done.
|
+ } |
}; |
} // end of namespace Ice |