|
[yoda-svn] r533 - trunk/include/YODAblackhole at projects.hepforge.org blackhole at projects.hepforge.orgFri Oct 5 15:23:39 BST 2012
Author: hoeth Date: Fri Oct 5 15:23:39 2012 New Revision: 533 Log: fuzzyEquals() bin edges checking for adding and subtracting bins Modified: trunk/include/YODA/Bin1D.h Modified: trunk/include/YODA/Bin1D.h ============================================================================== --- trunk/include/YODA/Bin1D.h Fri Oct 5 12:14:37 2012 (r532) +++ trunk/include/YODA/Bin1D.h Fri Oct 5 15:23:39 2012 (r533) @@ -268,7 +268,8 @@ /// This operator is defined for adding two bins with equivalent binning. /// It cannot be used to merge two bins into one larger bin. Bin1D<DBN>& add(const Bin1D<DBN>& b) { - if (_edges != b._edges) { + if (!fuzzyEquals(_edges.first, b._edges.first) || + !fuzzyEquals(_edges.second, b._edges.second)) { throw LogicError("Attempted to add two bins with different edges"); } _dbn += b._dbn; @@ -281,7 +282,8 @@ /// This operator is defined for subtracting two bins with equivalent binning. /// It cannot be used to merge two bins into one larger bin. Bin1D<DBN>& subtract(const Bin1D<DBN>& b) { - if (_edges != b._edges) { + if (!fuzzyEquals(_edges.first, b._edges.first) || + !fuzzyEquals(_edges.second, b._edges.second)) { throw LogicError("Attempted to subtract two bins with different edges"); } _dbn -= b._dbn;
More information about the yoda-svn mailing list |