From 93f27c0b47b1dbacd65eacab96fb9b2f84970dc9 Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Fri, 23 Sep 2011 11:24:37 -0700 Subject: [PATCH] lily/bezier.cc: Flag a floating point problem --- lily/bezier.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)); } -- 2.39.5