diff --git a/src/util/Numerical.js b/src/util/Numerical.js index b81718d8..42457699 100644 --- a/src/util/Numerical.js +++ b/src/util/Numerical.js @@ -356,8 +356,8 @@ var Numerical = new function() { } // The cubic has been deflated to a quadratic. var count = Numerical.solveQuadratic(a, b1, c2, roots, min, max); - if (isFinite(x) && count >= 0 - && (count === 0 || x !== roots[count - 1]) + if (isFinite(x) && (count === 0 + || count > 0 && x !== roots[0] && x !== roots[1]) && (min == null || x > min - EPSILON && x < max + EPSILON)) roots[count++] = min == null ? x : clamp(x, min, max); return count;