From bb683c9291592144f1a51745341f1294d14cd553 Mon Sep 17 00:00:00 2001 From: sapics Date: Mon, 20 Jun 2016 09:52:09 +0900 Subject: [PATCH] Remove same value solution in solveCubic --- src/util/Numerical.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;