32.2 Roots of Quadratic Polynomials

Here we solve

$\displaystyle x^2+a_1x+a_0$ $\displaystyle =$ $\displaystyle 0,$ (32.1)

where $ a_1$ and $ a_0$ are real. Well known techniques (larger magnitude root $ x_1$ computed by quadratic formula, smaller magnitude root computed by applying Vieta's rule: $ x_2=a_0/x_1$) are used to ensure numerical accuracy of the roots. Additionally the code is equipped to deal with extremely large coefficients, such that computational overflow will not occur. A coefficient rescaling technique is applied if during evaluation of the quadratic formula either the term $ (a_1/2)^2$ or the discriminant $ (a_1/2)^2-a_0$ become larger than the largest positive number on the machine.