summaryrefslogtreecommitdiff
path: root/utils/nan.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-02-29 01:12:40 -0500
committerChris Dyer <cdyer@cs.cmu.edu>2012-02-29 01:12:40 -0500
commit54bcfb835232d190a5ab6f0bd825de8a50dae126 (patch)
tree161988135be75a47524cdf2efbba7bdf06c9bd65 /utils/nan.h
parent89238977fc9d8f8d9a6421b0d4f35afc200f08e7 (diff)
cleanup, mpi-ify lblmodel
Diffstat (limited to 'utils/nan.h')
-rw-r--r--utils/nan.h42
1 files changed, 0 insertions, 42 deletions
diff --git a/utils/nan.h b/utils/nan.h
deleted file mode 100644
index 257364d5..00000000
--- a/utils/nan.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef NAN_H
-#define NAN_H
-//TODO: switch to C99 isnan isfinite isinf etc. (faster)
-
-#include <limits>
-
-template <bool> struct nan_static_assert;
-template <> struct nan_static_assert<true> { };
-
-// is_iec559 i.e. only IEEE 754 float has x != x <=> x is nan
-template<typename T>
-inline bool is_nan(T x) {
-// static_cast<void>(sizeof(nan_static_assert<std::numeric_limits<T>::has_quiet_NaN>));
- return std::numeric_limits<T>::has_quiet_NaN && (x != x);
-}
-
-template <typename T>
-inline bool is_inf(T x) {
-// static_cast<void>(sizeof(nan_static_assert<std::numeric_limits<T>::has_infinity>));
- return x == std::numeric_limits<T>::infinity() || x == -std::numeric_limits<T>::infinity();
-}
-
-template <typename T>
-inline bool is_pos_inf(T x) {
-// static_cast<void>(sizeof(nan_static_assert<std::numeric_limits<T>::has_infinity>));
- return x == std::numeric_limits<T>::infinity();
-}
-
-template <typename T>
-inline bool is_neg_inf(T x) {
-// static_cast<void>(sizeof(nan_static_assert<std::numeric_limits<T>::has_infinity>));
- return x == -std::numeric_limits<T>::infinity();
-}
-
-//c99 isfinite macro shoudl be much faster
-template <typename T>
-inline bool is_finite(T x) {
- return !is_nan(x) && !is_inf(x);
-}
-
-
-#endif