diff options
author | Chris Dyer <redpony@gmail.com> | 2009-12-19 01:49:05 -0500 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2009-12-19 01:49:05 -0500 |
commit | 39b9c1e0aaec81492d81e541daf7703ba8c517ff (patch) | |
tree | b444b94e22f5c09f619be51feb42bff1bddbcc2e /decoder | |
parent | 544da4d8e42858b19e6229936df56d44d61b1f38 (diff) |
fix rounding error failure
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/cdec.cc | 3 |
1 files changed, 2 insertions, 1 deletions
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<RandomNumberGenerator<boost::mt19937> > 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<prob_t, EdgeProb, SparseVector<double>, 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); } |