Remove same value solution in solveCubic

This commit is contained in:
sapics 2016-06-20 09:52:09 +09:00
parent ab24f92373
commit bb683c9291

View file

@ -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;