Skip to main content

Exercises 1.5 Exercises

1.
Evaluate in \(D_3\) the quantities
\begin{equation*} 7\times(8/7-1)-1 \end{equation*}
and
\begin{equation*} 10\times(11/10-1)-1\text{.} \end{equation*}
2.
Evaluate in \(D_3\) the quantity
\begin{equation*} 1.00 + 0.002 + 0.002 + 0.002 \end{equation*}
first summing from left to right and then from right to left.

This calculation shows that one should always sum numbers after sorting them from the smallest to the largest.
3.
Evaluate in \(D_3\) the value of the mathematically (but not numerically!) equivalent expressions
\begin{equation*} 1-\sqrt{1-a} \end{equation*}
and
\begin{equation*} \frac{a}{1+\sqrt{1-a}} \end{equation*}
for \(a=1.00\times10^{-3}\text{.}\)

Which one gives the most accurate result? Why?
4.
Let \(a=1.2\times10^{300}\) and \(b=3\times10^{300}\text{.}\) What happens if one tries to evaluate in double precision the quantity \(\sqrt{a^2+b^2}\text{?}\) How can one re-write \(\sqrt{a^2+b^2}\) so that the calculation is doable in double precision with these values for \(a\) and \(b\text{?}\)
5.
Consider the system \(B_3\), where the base is 2 and only three digits are kept. Find the expressions of \(1/3\) in \(B_3\) and evaluate the quantity \(3\times1/3\text{.}\)
6.
Find the expressions of \(1/3\) in single and double precision and explain why, although \(1/3\) has infinitely many digits in base 2, in both cases one finds that \(3\times1/3\) is identically equal to 1.
7.
Evaluate in double precision the quantities \(1+0.6\) and \(1+0.2+0.2+0.2\) and explain why they do not give the same result.