A program must evaluate r=a2+1−ar=\sqrt{a^2+1}-ar=a2+1−a at a=108a=10^8a=108. In its arithmetic, a2+1a^2+1a2+1 rounds to a2a^2a2, and the subsequent square root returns aaa, so direct evaluation gives zero.
Which expression is algebraically equivalent to rrr in exact arithmetic and avoids subtracting nearly equal quantities when evaluated under this rounding model?
1a2+1+a\displaystyle \frac{1}{\sqrt{a^2+1}+a}a2+1+a1
a2+1+a1\displaystyle \frac{\sqrt{a^2+1}+a}{1}1a2+1+a
1a2+1+a\displaystyle \frac{1}{a^2+1+a}a2+1+a1
1a2+1−a\displaystyle \frac{1}{\sqrt{a^2+1}-a}a2+1−a1
Unlock full course notes by signing up
Losing a small difference
A demonstration program uses decimal arithmetic with three significant digits. It first rounds each exact input, a=8124.6a=8124.6a=8124.6 and b=8123.2b=8123.2b=8123.2, to three significant digits, then subtracts the stored values. The subtraction result is also rounded to three significant digits.
Complete the table for the computed difference d^\hat{d}d^ and the exact difference d=a−bd=a-bd=a−b. Enter exact decimal numbers. Enter the final error as a percentage relative to the exact difference, without a percent sign.