From b5b9f7f8b7c3acf9b19a5231b7aee3be566e7b5f Mon Sep 17 00:00:00 2001
From: Hadrien G <knights_of_ni@gmx.com>
Date: Tue, 27 Jun 2017 17:10:16 +0200
Subject: [PATCH] Added NaN-proof comparison function for doubles

---
 scripts/compareRootFiles.hpp | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/compareRootFiles.hpp b/scripts/compareRootFiles.hpp
index a6cf18bb..5f21b713 100644
--- a/scripts/compareRootFiles.hpp
+++ b/scripts/compareRootFiles.hpp
@@ -108,9 +108,9 @@ compare(const T& x, const T& y)
 }
 
 // ...but we'll want to tweak that a little for floats, to handle NaNs better...
-template <>
+template <typename T>
 Ordering
-compare(const float& x, const float& y)
+compareFloat(const T& x, const T& y)
 {
   if (std::isless(x, y)) {
     return Ordering::SMALLER;
@@ -121,6 +121,19 @@ compare(const float& x, const float& y)
   }
 }
 
+template<>
+Ordering
+compare(const float& x, const float& y)
+{
+  return compareFloat(x, y);
+}
+
+template<>
+Ordering
+compare(const double& x, const double& y) {
+  return compareFloat(x, y);
+}
+
 // ...and for vectors, where the default lexicographic comparison cannot
 // efficiently tell all of what we want in a single vector iteration pass.
 template <typename U>
-- 
GitLab