Changed root finder to use base-2 exponent of bound
Since the root isolation algorithm uses a power of two as bound anyway, it makes sense to use it's exponent in method interfaces and throughout the algorithm. This simplifies multiplications to cheap shifts and will make it easier to detect when the isolating interval size is 1. Also added some method documentation.
This commit is contained in:
@@ -89,7 +89,7 @@ begin
|
||||
// y = 3 * (x - 34000) * (x - 23017) * (x - 5) * (x^2 - 19) * (x + 112)
|
||||
// = 3 * x^6 - 170730 * x^5 + 2329429920 * x^4 + 251300082690 * x^3 - 1270471872603 * x^2 + 4774763204640 * x - 24979889760000
|
||||
a := TBigIntPolynomial.Create([-24979889760000, 4774763204640, -1270471872603, 251300082690, 2329429920, -170730, 3]);
|
||||
r := TPolynomialRoots.BisectIsolation(a, TBigInt.One << 15);
|
||||
r := TPolynomialRoots.BisectIsolation(a, 15);
|
||||
AssertBisectResult(r, expRoots);
|
||||
r.Free;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user