From: Keith OHara Date: Fri, 23 Sep 2011 18:24:37 +0000 (-0700) Subject: lily/bezier.cc: Flag a floating point problem X-Git-Tag: release/2.15.13-1~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=93f27c0b47b1dbacd65eacab96fb9b2f84970dc9;p=lilypond.git lily/bezier.cc: Flag a floating point problem --- diff --git a/lily/bezier.cc b/lily/bezier.cc index 0a0f4cfc6f..38c40f3ffc 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -254,7 +254,14 @@ Bezier::minmax (Axis ax, Real l, Real r, Direction d) const for (vsize i = solutions.size (); i--;) { Real t = solutions[i]; - if (t >= 0 && t <= 1 && p.eval (t) >= l && p.eval (t) <= r) + if (t >= 0 && t <= 1 + // FIXME: floating point comparison for equality + // Two of the t in solutions were found by solving + // p(t) = l, bzw. r, and we want this test to pass for these t, + // but it can easily fail if floating point internal precision + // differs from storage precision. + // Better to store separately the two t for which p(t) = l and r + && p.eval (t) >= l && p.eval (t) <= r) values.push_back (other_p.eval (t)); }