diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 3c21d9f3ee..7bcbcd5039 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -104,7 +104,10 @@ VSTPlugin::set_parameter (uint32_t which, float val) { float v = get_parameter (which); - cerr << name() << " setting parameter #" << which << " to " << val << " current " << v << " == ? " << (v == val) << " delta " << std::setprecision(15) << (v - val) << endl; + cerr << name() << " setting parameter #" << which << " to " << val << " current " << v << " == ? " + << (v == val) << " floateq ? " << floateq (v, val, 1) << " delta " + << std::setprecision(15) + << (v - val) << endl; if (PBD::floateq (get_parameter (which), val, 1)) { return; diff --git a/libs/pbd/pbd/floating.h b/libs/pbd/pbd/floating.h index f707dc9f5b..ef97ce8fcc 100644 --- a/libs/pbd/pbd/floating.h +++ b/libs/pbd/pbd/floating.h @@ -7,6 +7,8 @@ #ifndef __libpbd__floating_h__ #define __libpbd__floating_h__ +#include + namespace PBD { union Float_t @@ -26,18 +28,18 @@ union Float_t static inline bool floateq (float a, float b, int max_ulps_diff) { - Float_t ua(a); - Float_t ub(b); + Float_t ua (a); + Float_t ub (b); + if (a == b) { + return true; + } + // Different signs means they do not match. if (ua.negative() != ub.negative()) { - // Check for equality to make sure +0==-0 - if (a == b) { - return true; - } return false; } - + // Find the difference in ULPs. int ulps_diff = abs (ua.i - ub.i);