Skip to content

Commit 9800ada

Browse files
committed
Removing leading, near zero coefficient reduction in Solve_Polynomial().
Leading coefficients of < SMALL_ENOUGH (1e-10) were being dropped reducing the order of the incoming polynomial when the near zero values had meaning with respect to roots. Led to both false roots and missed roots.
1 parent 92233d1 commit 9800ada

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

source/core/math/polynomialsolver.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,28 +1554,14 @@ static int polysolve(int order, const DBL *Coeffs, DBL *roots)
15541554

15551555
int Solve_Polynomial(int n, const DBL *c0, DBL *r, int sturm, DBL epsilon, RenderStatistics& stats)
15561556
{
1557-
int roots, i;
1557+
int roots;
15581558
const DBL *c;
15591559

15601560
stats[Polynomials_Tested]++;
15611561

15621562
roots = 0;
15631563

1564-
/*
1565-
* Determine the "real" order of the polynomial, i.e.
1566-
* eliminate small leading coefficients.
1567-
*/
1568-
1569-
i = 0;
1570-
1571-
while ((i < n) && (fabs(c0[i]) < SMALL_ENOUGH))
1572-
{
1573-
i++;
1574-
}
1575-
1576-
n -= i;
1577-
1578-
c = &c0[i];
1564+
c = &c0[0];
15791565

15801566
switch (n)
15811567
{

0 commit comments

Comments
 (0)