From e9ba3adc19b1d4628da23d81a113b8ea9a803bdd Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Tue, 31 Mar 2015 09:49:33 +0000
Subject: [PATCH] Segmentation: Avoid direct comparison with floats

---
 DDSegmentation/src/Segmentation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/DDSegmentation/src/Segmentation.cpp b/DDSegmentation/src/Segmentation.cpp
index c38abe05a..d30dc47ee 100644
--- a/DDSegmentation/src/Segmentation.cpp
+++ b/DDSegmentation/src/Segmentation.cpp
@@ -141,7 +141,7 @@ double Segmentation::binToPosition(long64 bin, double cellSize, double offset) {
 
 /// Helper method to convert a 1D position to a cell ID
 int Segmentation::positionToBin(double position, double cellSize, double offset) {
-	if (cellSize == 0.) {
+	if (cellSize <= 1e-10) {
 		throw runtime_error("Invalid cell size: 0.0");
 	}
 	return int(floor((position + 0.5 * cellSize - offset) / cellSize));
-- 
GitLab