# Routine allr finds all roots of a polynomial. # # Relies on root and div from this directory. # MODE C = LONG COMPLEX; MODE P = [~] C; PROC allr = (P p)P: (INT n = UPB p; [n-1]C rts; FLEX [n]C mp := p; FOR j TO n-1 DO C rt = root(mp); rts[j] := rt; DR sol = div(mp, (-rt, 1)); IF m2((r OF sol)[1]) > small THEN print(("Failure", newline)) ELSE mp := q OF sol FI OD; rts);