From 39b9c1e0aaec81492d81e541daf7703ba8c517ff Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sat, 19 Dec 2009 01:49:05 -0500 Subject: fix rounding error failure --- decoder/cdec.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'decoder') diff --git a/decoder/cdec.cc b/decoder/cdec.cc index d517e451..b130e7fd 100644 --- a/decoder/cdec.cc +++ b/decoder/cdec.cc @@ -39,6 +39,7 @@ namespace po = boost::program_options; // some globals ... boost::shared_ptr > rng; +static const double kMINUS_EPSILON = -1e-6; // don't be too strict namespace Hack { void MaxTrans(const Hypergraph& in, int beam_size); } @@ -471,7 +472,7 @@ int main(int argc, char** argv) { if (write_gradient) { log_ref_z = log( InsideOutside, EdgeFeaturesWeightFunction>(forest, &ref_exp)); - if (log_z < log_ref_z) { + if ((log_z - log_ref_z) < kMINUS_EPSILON) { cerr << "DIFF. ERR! log_z < log_ref_z: " << log_z << " " << log_ref_z << endl; exit(1); } -- cgit v1.2.3