Solution:

a.The condition is that the computed value is rounded off when this expression is evaluated in finite precision arithmetic.

b.Given: \(a = 995.1\ and\ b = 995.0\)

\(a^{2}\ -\ b^{2} = (995.1)^{2}\ -\ (995.0)^{2}\)

\(= 990224.01\ -\ 990025\)

\(= 199.01\)

4 digit rounding arithmetic we have \(a^{2}\ -\ b^{2} = 199.0.\)

The relative error becomes \(\frac{|199.01\ -\ 199.0|}{199.01}=\frac{0.01}{199.01}\approx0.525\ \times\ 10^{-4}\)

Conclusion:

Given: \(a = 995.1\ and\ b = 995.0\)

\((a\ +\ b)(a\ -\ b) = (995.1\ +\ 995.0)(995.1\ -\ 995.0)\)

\(= (199.01)(0.1)\)

4 digit rounding arithmetic we have \((a\ +\ b)(a\ -\ b) = 199.0.\)

The relative error becomes \(\frac{|199.01\ -\ 199.0|}{199.01}=\frac{0.01}{199.01}\approx0.525\ \times\ 10^{-4}\)

c.The expression \((a\ +\ b)(a\ -\ b)\ is\ more\ accurate\ than\ a^{2}\ -\ b^{2}\) when a and b have exact floating point representations because the expression

\((a\ +\ b)(a\ -\ b)\) involves simple addition and subtraction of decimals, then easy multiplication takes place,

however the expression \(a^{2}\ -\ b^{2}\) involves squaring of decimals resulting in more decimals , then subtraction takes place. The latter may involves round off whereas the former may not.

a.The condition is that the computed value is rounded off when this expression is evaluated in finite precision arithmetic.

b.Given: \(a = 995.1\ and\ b = 995.0\)

\(a^{2}\ -\ b^{2} = (995.1)^{2}\ -\ (995.0)^{2}\)

\(= 990224.01\ -\ 990025\)

\(= 199.01\)

4 digit rounding arithmetic we have \(a^{2}\ -\ b^{2} = 199.0.\)

The relative error becomes \(\frac{|199.01\ -\ 199.0|}{199.01}=\frac{0.01}{199.01}\approx0.525\ \times\ 10^{-4}\)

Conclusion:

Given: \(a = 995.1\ and\ b = 995.0\)

\((a\ +\ b)(a\ -\ b) = (995.1\ +\ 995.0)(995.1\ -\ 995.0)\)

\(= (199.01)(0.1)\)

4 digit rounding arithmetic we have \((a\ +\ b)(a\ -\ b) = 199.0.\)

The relative error becomes \(\frac{|199.01\ -\ 199.0|}{199.01}=\frac{0.01}{199.01}\approx0.525\ \times\ 10^{-4}\)

c.The expression \((a\ +\ b)(a\ -\ b)\ is\ more\ accurate\ than\ a^{2}\ -\ b^{2}\) when a and b have exact floating point representations because the expression

\((a\ +\ b)(a\ -\ b)\) involves simple addition and subtraction of decimals, then easy multiplication takes place,

however the expression \(a^{2}\ -\ b^{2}\) involves squaring of decimals resulting in more decimals , then subtraction takes place. The latter may involves round off whereas the former may not.