From c29dd916e8c6391ddb78113a9a60ac70bb06b7da Mon Sep 17 00:00:00 2001
From: Matt King <matthew.king@stfc.ac.uk>
Date: Tue, 13 Oct 2015 12:05:07 +0100
Subject: [PATCH] Increased tolerance value to fix precision issue

Refs #13508
---
 Framework/MDAlgorithms/src/CompactMD.cpp      | 34 ++++---------------
 .../src/IntegrateMDHistoWorkspace.cpp         |  2 +-
 2 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/Framework/MDAlgorithms/src/CompactMD.cpp b/Framework/MDAlgorithms/src/CompactMD.cpp
index cf20a37a0dc..6970b3d2475 100644
--- a/Framework/MDAlgorithms/src/CompactMD.cpp
+++ b/Framework/MDAlgorithms/src/CompactMD.cpp
@@ -30,34 +30,14 @@ createPBinStringVector(std::vector<Mantid::coord_t> minVector,
                    "maximum extent with non-zero signal"
                 << std::endl;
     }
-    // We are working with Centres and not Bin Edges so we know that we will
-    // always be half a bin width away from the closest bin edge.
-
-    // We will only crop when we set minimum pbin > minimum extent of that
-    // dimension
-    // otherwise we should not crop.
-    if (minVector[iter] - (inputWs->getDimension(iter)->getBinWidth() * 0.5) >
-        inputWs->getDimension(iter)->getMinimum()) {
-      minVector[iter] = Mantid::coord_t(
-          minVector[iter] - (inputWs->getDimension(iter)->getBinWidth() * 0.5));
-    }
-    // We will only crop when we set maximum pbin < maximum extent of that
-    // dimension
-    // otherwise we should not crop.
-    if (maxVector[iter] + (inputWs->getDimension(iter)->getBinWidth() * 0.5) <
-        inputWs->getDimension(iter)->getMaximum()) {
-      maxVector[iter] = Mantid::coord_t(
-          maxVector[iter] + (inputWs->getDimension(iter)->getBinWidth() * 0.5));
-    }
-    // when Min == Max we know that there is no signal inside that dimension
-    // so just use the original extents to copy that dimension.
-    if (minVector[iter] == maxVector[iter]) {
-      minVector[iter] = inputWs->getDimension(iter)->getMinimum();
-      maxVector[iter] = inputWs->getDimension(iter)->getMaximum();
-    }
     // creating pbin string using Min and Max Centre positions
-    auto pBinStr = boost::lexical_cast<std::string>(minVector[iter]) + ",0," +
-                   boost::lexical_cast<std::string>(maxVector[iter]);
+    auto pBinStr = boost::lexical_cast<std::string>(
+                       minVector[iter] -
+                       (inputWs->getDimension(iter)->getBinWidth() * 0.5)) +
+                   ",0," +
+                   boost::lexical_cast<std::string>(
+                       maxVector[iter] +
+                       (inputWs->getDimension(iter)->getBinWidth() * 0.5));
     pBinStrVector.push_back(pBinStr);
   }
   return pBinStrVector;
diff --git a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
index 764ccdf652c..230e2e75f33 100644
--- a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
+++ b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp
@@ -104,7 +104,7 @@ Mantid::coord_t getPrecisionCorrectedCoordinate(Mantid::coord_t position,
 
   // Check if the relative deviation is larger than 1e-6
   const auto deviation = fabs((nearest - position) / binWidth);
-  const auto tolerance = 1e-6;
+  const auto tolerance = 1e-5;
   Mantid::coord_t coordinate(position);
   if (deviation < tolerance) {
     coordinate = nearest;
-- 
GitLab