From: Simon Tatham Date: Sat, 15 Mar 2014 16:48:02 +0000 (+0000) Subject: Fix hang during output of (7,6). X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4e22cc35232dcc00a647d308c696bd7d3b79a15a;p=matchsticks-search.git Fix hang during output of (7,6). I had rather hoped that GLPK would always output a min fragment slightly _less_ than the true rational value, on the basis that some of its minima would be slightly below the right value and some slightly above. Sadly, (7,6) consistently guesses high, so I must fall back to the usual 1e10 bodge to round to rationals. --- diff --git a/main.c b/main.c index 5850860..96f945c 100644 --- a/main.c +++ b/main.c @@ -796,7 +796,7 @@ static void report(void) { if (ai[i][j] > 0 && ai[i][j] < imin) imin = ai[i][j]; - if ((double)imin / d < min) + if (abs((double)imin / d - min) > 1e-10) goto next_d; /*