|
[Rivet-svn] r2632 - trunk/include/Rivet/Mathblackhole at projects.hepforge.org blackhole at projects.hepforge.orgSun Aug 1 18:49:11 BST 2010
Author: buckley Date: Sun Aug 1 18:49:11 2010 New Revision: 2632 Log: Improved fuzzyEquals implementation, thanks to Mike Seymour for pointing out the deficiencies of the previous form Modified: trunk/include/Rivet/Math/MathUtils.hh Modified: trunk/include/Rivet/Math/MathUtils.hh ============================================================================== --- trunk/include/Rivet/Math/MathUtils.hh Sun Aug 1 13:56:01 2010 (r2631) +++ trunk/include/Rivet/Math/MathUtils.hh Sun Aug 1 18:49:11 2010 (r2632) @@ -49,7 +49,7 @@ inline bool fuzzyEquals(double a, double b, double tolerance=1E-5) { const double absavg = fabs(a + b)/2.0; const double absdiff = fabs(a - b); - const bool rtn = (absavg == 0.0 && absdiff == 0.0) || absdiff/absavg < tolerance; + const bool rtn = (absavg == 0.0 && absdiff == 0.0) || absdiff < tolerance*absavg; return rtn; }
More information about the Rivet-svn mailing list |