]> git.donarmstrong.com Git - lilypond.git/commitdiff
lily/bezier.cc: Flag a floating point problem
authorKeith OHara <k-ohara5a5a@oco.net>
Fri, 23 Sep 2011 18:24:37 +0000 (11:24 -0700)
committerKeith OHara <k-ohara5a5a@oco.net>
Fri, 23 Sep 2011 18:24:37 +0000 (11:24 -0700)
lily/bezier.cc

index 0a0f4cfc6ff3f18962548c44bf391e9ba99762ad..38c40f3ffc00e2c4df2827408ef94c2d65aca4fd 100644 (file)
@@ -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));
     }