Crate horner_eval

source ·
Expand description

horner-eval

A macro for evaluating polynomials via Horner’s rule.

Macros

  • Evaluate the polynomial a₀ + a₁x + ⋯ + aₙ₋₁xⁿ⁻¹ + aⁿxⁿ via Horner’s rule. This macro unrolls what would otherwise be a loop into the expression (⋯(aₙx + aₙ₋₁)x + ⋯ + a₁)x + a₀.

Functions

  • Evaluate the polynomial a₀ + a₁x + ⋯ + aₙ₋₁xⁿ⁻¹ + aⁿxⁿ via Horner’s rule. As the name indicates, this function uses an explicit loop to accommodate dynamically-sized coefficient slices.
  • Identical to x.mul_add(a, b); used to generate expression nest without provoking ambiguities which would otherwise arise due to automatic dereferencing.