This is an automated email from the git hooks/post-receive script. hmmr-guest pushed a commit to branch master in repository aghermann.
commit 181469ff1197426dbf24550276cd7d63b7f20e84 Author: Andrei Zavada <[email protected]> Date: Sun Sep 22 03:10:44 2013 +0300 painstaking dbl_cmp, feat. DBL_EPSILON --- upstream/src/common/lang.hh | 11 +++++++++++ upstream/src/libmetrics/mc-artifacts.hh | 24 +++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/upstream/src/common/lang.hh b/upstream/src/common/lang.hh index ad71d85..89406ec 100644 --- a/upstream/src/common/lang.hh +++ b/upstream/src/common/lang.hh @@ -16,6 +16,8 @@ # include "config.h" #endif +#include <cfloat> +#include <cmath> #include <unistd.h> #include <stdio.h> @@ -26,6 +28,15 @@ namespace agh { typedef unsigned long hash_t; +inline int dbl_cmp( double x, double y) __attribute__ ((pure)); +inline int dbl_cmp( double x, double y) +{ + if ( fabs(x - y) > DBL_EPSILON ) + return (x > y) ? 1 : -1; + else + return 0; +} + // g++ bits diff --git a/upstream/src/libmetrics/mc-artifacts.hh b/upstream/src/libmetrics/mc-artifacts.hh index f59afc6..7b1e3c8 100644 --- a/upstream/src/libmetrics/mc-artifacts.hh +++ b/upstream/src/libmetrics/mc-artifacts.hh @@ -15,6 +15,7 @@ #include <vector> #include <valarray> +#include "common/lang.hh" #include "libsigproc/sigproc.hh" #include "aghermann/expdesign/dirlevel.hh" @@ -41,17 +42,18 @@ struct SArtifactDetectionPPack { bool operator==( const SArtifactDetectionPPack& rv) const { - return scope == rv.scope && - upper_thr == rv.upper_thr && - lower_thr == rv.lower_thr && - f0 == rv.f0 && - fc == rv.fc && - bandwidth == rv.bandwidth && - mc_gain == rv.mc_gain && - iir_backpolate == rv.iir_backpolate && - E == rv.E && - dmin == rv.dmin && - dmax == rv.dmax && + using agh::dbl_cmp; + return dbl_cmp(scope, rv.scope) == 0 && + dbl_cmp(upper_thr, rv.upper_thr) == 0 && + dbl_cmp(lower_thr, rv.lower_thr) == 0 && + dbl_cmp(f0, rv.f0) == 0 && + dbl_cmp(fc, rv.fc) == 0 && + dbl_cmp(bandwidth, rv.bandwidth) == 0 && + dbl_cmp(mc_gain, rv.mc_gain) == 0 && + dbl_cmp(iir_backpolate, rv.iir_backpolate) == 0 && + dbl_cmp(E, rv.E) == 0 && + dbl_cmp(dmin, rv.dmin) == 0 && + dbl_cmp(dmax, rv.dmax) == 0 && sssu_hist_size == rv.sssu_hist_size && smooth_side == rv.smooth_side && estimate_E == rv.estimate_E && -- Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
