From 8dc4fcd0ea91d1b41229d1309285b00653e9e4db Mon Sep 17 00:00:00 2001
From: Harry Jeffery <henry.jeffery@stfc.ac.uk>
Date: Tue, 5 May 2015 12:00:19 +0100
Subject: [PATCH] Refs #11688 Fix rounding error

---
 Code/Mantid/Framework/Algorithms/src/Stitch1D.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Code/Mantid/Framework/Algorithms/src/Stitch1D.cpp b/Code/Mantid/Framework/Algorithms/src/Stitch1D.cpp
index 2523e522ca3..813bfdb825d 100644
--- a/Code/Mantid/Framework/Algorithms/src/Stitch1D.cpp
+++ b/Code/Mantid/Framework/Algorithms/src/Stitch1D.cpp
@@ -501,8 +501,8 @@ void Stitch1D::exec() {
   const double intersectionMin = intesectionXRegion.get<0>();
   const double intersectionMax = intesectionXRegion.get<1>();
 
-  const double startOverlap = getStartOverlap(intersectionMin, intersectionMax);
-  const double endOverlap = getEndOverlap(intersectionMin, intersectionMax);
+  double startOverlap = getStartOverlap(intersectionMin, intersectionMax);
+  double endOverlap = getEndOverlap(intersectionMin, intersectionMax);
 
   if (startOverlap > endOverlap) {
     std::string message = boost::str(
@@ -518,6 +518,12 @@ void Stitch1D::exec() {
   const double &xMin = params.front();
   const double &xMax = params.back();
 
+  if (std::abs(xMin - startOverlap) < 1E-6)
+    startOverlap = xMin;
+
+  if (std::abs(xMax - endOverlap) < 1E-6)
+    endOverlap = xMax;
+
   if (startOverlap < xMin) {
     std::string message = boost::str(
         boost::format("Stitch1D StartOverlap is outside the available X range "
-- 
GitLab