Skip to content

Commit ae4867c

Browse files
committed
Changing polysolve visible_roots and numchanges zero test to <=0.
Depending upon value used for reducing and trimming the sturm chain equations in modp, the sphere_sweep b_spline functions can return negative root counts when there are no roots.
1 parent b1bea42 commit ae4867c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/core/math/polynomialsolver.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,11 @@ static int polysolve(int order, const DBL *Coeffs, DBL *roots)
15281528

15291529
/* Get the total number of visible roots */
15301530

1531-
if ((nroots = visible_roots(np, sseq, &atmin, &atmax)) == 0)
1531+
// NOTE: Changed to <=0 test over ==0 due sphere_sweep b_spline
1532+
// going negative when the modp leading coef filter set lower.
1533+
// Similar change to the numchanges based test below.
1534+
1535+
if ((nroots = visible_roots(np, sseq, &atmin, &atmax)) <= 0)
15321536
{
15331537
return(0);
15341538
}
@@ -1578,7 +1582,7 @@ static int polysolve(int order, const DBL *Coeffs, DBL *roots)
15781582

15791583
nroots = atmin - atmax;
15801584

1581-
if (nroots == 0)
1585+
if (nroots <= 0)
15821586
{
15831587
return(0);
15841588
}

0 commit comments

Comments
 (0)