0
$\begingroup$

Suppose a machine with a floating point system ($\beta$,$t$,$L$,$U$) $ = (10, 8, -50, 50)$ is used to calculate the roots of the quadratic equation $$ax^2+bx+c=0$$ where $a,b,$ and $c$ are given, real coefficients

For each of the following, state the numerical difficulties that arise if one uses the standard formula for computing the roots. Explain how to overcome these difficulties (if possible)

I am stuck on the third problem that has $a = 10^{-30}, b = -10^{30}, c = 10^{30}$

Solving for the roots we get $x = \frac{10^{30} \pm \sqrt{(-10^{30})^2-4(10^{-30}10^{30})}}{2*10^{-30}}$

I have rearranged this equation several times, but I cannot seem to find a way where I do not get something around $10^{60}$, which cannot be represented by this floating point system (I can get rid of squaring $b$ by factoring, but it seems I still end up with $10^{60}$ in the end). I am not sure if it is impossible or if I am missing some sort of trick. Any help is appreciated, thank you.

$\endgroup$
1
$\begingroup$

The instructions do not say "solve". They say "identify the numerical difficulties". The fact that you get overflow is the difficulty.

And there is no way around it if you want both roots. Clearly one of the roots is close to $1$ and the product of both roots has to be $10^{60}$, so the remaining root is forced to to be too big for your overflow limit (limit = $10^{50}$).

$\endgroup$
1
$\begingroup$

Let $x = 10^{15} y :$
$$10^{-30} y^2 - 10^{15} y + 1 = 0$$

However, one of x roots will overflow.
Perhaps other calculations can use y instead ?

We sometimes do this, say with logarithm, to extend float range.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.