Anonymous user
Polynomial long division: Difference between revisions
Updated D entry
No edit summary |
(Updated D entry) |
||
Line 690:
Tuple!(double[], double[]) polyDiv(in double[] inN, in double[] inD)
nothrow pure
// Code smell: a function that does two things.
static int trimAndDegree(T)(ref T[] poly) nothrow pure @safe @nogc {
poly = poly.retro.find!q{ a != b }(0.0).retro;
return poly.length.signed - 1;
}
const(double)[] D = inD;
const dD = trimAndDegree(D);
Line 719:
int trimAndDegree1(T)(ref T[] poly) nothrow pure @safe @nogc {
poly.length -= poly.retro.countUntil!q{ a != 0 };
return poly.length.signed - 1;
|