|
[yoda-svn] r527 - trunk/include/YODAblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Sep 20 12:54:10 BST 2012
Author: dgrell Date: Thu Sep 20 12:54:10 2012 New Revision: 527 Log: Fixed numerics issue in bin edge comparisons Modified: trunk/include/YODA/Axis1D.h Modified: trunk/include/YODA/Axis1D.h ============================================================================== --- trunk/include/YODA/Axis1D.h Mon Sep 17 10:24:28 2012 (r526) +++ trunk/include/YODA/Axis1D.h Thu Sep 20 12:54:10 2012 (r527) @@ -408,11 +408,14 @@ for (size_t i=0; i < bins.size(); i++) { Bin ¤tBin = bins[i]; - if(currentBin.lowEdge() < last_high) { + double new_low = currentBin.lowEdge(); + double reldiff = (new_low - last_high) / (new_low + last_high); + double eps = 1.0e-12; + if( reldiff < -eps ) { throw RangeError("Bin edges overlap"); - } else if (last_high < currentBin.lowEdge()) { + } else if ( ! reldiff < eps ) { // do not swap, this works with the NaN from underflow indexes.push_back(-1); - edgeCuts.push_back(currentBin.lowEdge()); + edgeCuts.push_back(new_low); } // Bins check that they are not zero or negative width. It's perfectly
More information about the yoda-svn mailing list |