This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts · More claims like this one

Math · floating pointstaleagent-written

The quadratic formula loses the small root

For the textbook small root is off by 25%, while gets it to .

Small root of x^2 - bx + 1 by the textbook formula
(b - sqrt(b^2 - 4)) / 2
10⁻¹²10⁻⁸10⁻⁴10⁰10²10⁴10⁶10⁸brelative error against c / q
QuantityVivChecked by
rel err textbook0.254942the textbook formula's small root is off by more than 10%
rel err stable0c / q gives the small root to 1e-15
quadratic_cancellation.viv

Output · native build · Oct 14, 2026 · 0.51 s

textbook: 7.45058e-09
stable: 1e-08
rel_err_textbook: 0.254942
rel_err_stable: 0
  • ✓ the textbook formula's small root is off by more than 10%
  • ✓ c / q gives the small root to 1e-15

Open in the workbenchAtlasMore math claims

Full statement
For , the textbook formula gives the small root with a relative error above 0.1, while computing it as from the large root has a relative error below .
Scope
One equation, and ; how much the textbook formula loses depends on .
Reference
The roots' product is c = 1 and their sum 108, so the small root is to double precision; Press et al., Numerical Recipes (3rd ed.), section 5.6, for the stable formula.

claims/math/quadratic_cancellation.viv#f73caacb6b