Polynomial long division: Difference between revisions
Content added Content deleted
(→{{header|zkl}}: bug fix) |
(→{{header|zkl}}: the rest of the bug fix) |
||
Line 1,947: | Line 1,947: | ||
str:=[0..].zipWith('wrap(n,a){ if(a) "+ %sx^%s ".fmt(a,n) else "" },terms) |
str:=[0..].zipWith('wrap(n,a){ if(a) "+ %sx^%s ".fmt(a,n) else "" },terms) |
||
.sink(String).walk() |
.sink(String).walk() |
||
.replace(" |
.replace("x^0 "," ").replace(" 1x"," x").replace("x^1 ","x ") |
||
.replace("+ -", "- "); |
.replace("+ -", "- "); |
||
if(not str) return(" "); // all zeros |
if(not str) return(" "); // all zeros |