Skip to content
Tech News
← Back to articles

Show HN: Compute polynomials twice as fast

read original get Knuth The Art of Computer Programming Vol. 2 → more articles
Why This Matters

A Show HN tool demonstrates that with one-time preprocessing of coefficients, a polynomial of degree n can be evaluated in about n/2 multiplications instead of Horner's n — roughly halving the multiply count. That matters wherever polynomial evaluation is hot code: math library approximations of exp/sin/cos, cryptography, hashing, and error-correcting codes. The web tool lets developers paste a polynomial, pick a field, and get the preprocessed form directly.

Key Takeaways
Worth a Look

Knuth The Art of Computer Programming Vol. 2 — The polynomial preprocessing trick that beats Horner's method is classic Knuth territory вolume 2 covers polynomial evaluation and arithmetic in depth. If this Show HN made you want the underlying theory rather than just the web tool, it's the reference to keep on the desk.

See Knuth The Art of Computer Programming Vol. 2 on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.

Evaluating Polynomials Fast

You may have heard about Horner's method, which evaluates a polynomial of degree n in n multiplications (n−1 if it is monic). But did you know that with a bit of preprocessing of the coefficients, ⌊n/2⌋+1 multiplications suffice for any monic polynomial, one more for a general one? You can use this to approximate functions like exp, sin, cos, or to evaluate polynomials in cryptography, hashing, and coding theory. Simply type a polynomial below, pick your field, and we'll preprocess it for you.