From 13849e71956f8a3a2142cadd24c4f2006a328a04 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 9 Mar 2014 23:14:24 +0000 Subject: [PATCH] Fix occasional 'min fragment 1.11022e-16' glitch. Seems to happen in multicore mode when the first worker reports a near-zero value of 'best', and then set_best reduces it to a negative number when it applies the rounding fudge, leading to the max_frags limits being set to negative things and all other workers' results being thrown away in preconsider_ok(). --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index a57bd72..8259c35 100644 --- a/main.c +++ b/main.c @@ -147,8 +147,10 @@ static void set_best(double new_best) { * subtract a fudge factor from our target. */ double near_best = best * 0.98 - 0.02; - n_max_frags = ceil(n / near_best) - 1; - m_max_frags = ceil(m / near_best) - 1; + if (near_best > 0) { + n_max_frags = ceil(n / near_best) - 1; + m_max_frags = ceil(m / near_best) - 1; + } } /*----- multicore support -----*/ -- 2.30.2