diff --git a/basis/math/polynomials/polynomials-tests.factor b/basis/math/polynomials/polynomials-tests.factor index 08f81a5bfa..22ac89bc7d 100644 --- a/basis/math/polynomials/polynomials-tests.factor +++ b/basis/math/polynomials/polynomials-tests.factor @@ -31,3 +31,5 @@ IN: math.polynomials.tests [ t ] [ { 1 1 1 } { 1 1 1 } p= ] unit-test [ { 0 0 } { 1 1 } ] [ { 1 1 1 1 } { 1 1 } pgcd ] unit-test +[ { 10 200 3000 } ] [ { 1 10 100 1000 } pdiff ] unit-test + diff --git a/basis/math/polynomials/polynomials.factor b/basis/math/polynomials/polynomials.factor index 57c3c5b8ef..df3900c92f 100644 --- a/basis/math/polynomials/polynomials.factor +++ b/basis/math/polynomials/polynomials.factor @@ -88,7 +88,7 @@ PRIVATE> [ V{ 0 } clone V{ 1 } clone ] 2dip swap (pgcd) [ >array ] bi@ ; : pdiff ( p -- p' ) - dup length v* { 0 } ?head drop ; + dup length iota v* unclip drop ; : polyval ( x p -- p[x] ) [ length swap powers ] [ nip ] 2bi v. ;