Take the polynomial $x^2+(-4*10^3)x+2$.
In the floating-point system with $b=10$, $m=4$, $e=4$, if I wanted to find the roots using the quadratic formula what would be the values of the roots?
I got 3.999 as one of my roots and 1.000 as the other but my 1.000 root does not make sense in terms of relative error (I get a huge number).
Could anyone help me with this by going through the steps?
There are various approaches. One can say that for the large root, the $2$ is insignificant, so the large root is about $4\times 10^3$. For the small root, $x^2$ is insignificant, so the small root is about $\frac{2}{400\times 10^3}$.
For greater accuracy, find the large root $R$ using the Quadratic Formula. The product of the roots is $2$, so the small root is $\frac{2}{R}$. No loss of significant digits from subtracting two large nearly equal quantities.
Or else (equivalently) for the small root we can use the Citardauq Formula $\frac{2c}{-b\pm \sqrt{b^2-4ac}}$. The small root is equal to $\frac{4}{4\times 10^3 +\sqrt{(4\times 10^3)^2-8}}$.