The quadratic formula loses the small root
For the textbook small root is off by 25%, while gets it to .
(b - sqrt(b^2 - 4)) / 2
| Quantity | Viv | Checked by |
|---|---|---|
rel err textbook | 0.254942 | the textbook formula's small root is off by more than 10% |
rel err stable | 0 | c / 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