pub fn horner<T>(x: T, coeffs: &[T]) -> T
Expand description
Evaluate a polynomial with Horner’s method.
The coefficients are listed from zeroth order to highest.
§Examples
use polyeval::horner;
let x = 7;
assert_eq!(horner(x, &[]), 0);
assert_eq!(horner(x, &[0]), 0);
assert_eq!(
horner(x, &[2, 3, 4]),
2 + x * (3 + x * 4)
);