TAOCP 4.2.2 Exercise 7

We seek floating binary numbers $u$ and $v$ for which (u\oplus v)^2>2(u^2\oplus v^2), where $\oplus$ denotes floating-point addition with rounding to the nearest floating binary number.

Section 4.2.2: Accuracy of Floating Point Arithmetic

Exercise 7. [M21] Let $\sqrt{\oplus}$ stand for $u \oplus u$. Find floating binary numbers $u$ and $v$ such that $(u \oplus v)^2 > 2(u^2 \oplus v^2)$.

Verified: yes
Solve time: 5m07s


Solution

We seek floating binary numbers $u$ and $v$ for which

$$ (u\oplus v)^2>2(u^2\oplus v^2), $$

where $\oplus$ denotes floating-point addition with rounding to the nearest floating binary number.

It suffices to exhibit one floating-point system and one pair $u,v$ for which the inequality holds.

Consider a binary floating-point system with precision $p=2$, normalized significands $1.0_2$ and $1.1_2$, and rounding to nearest.

Take

$$ u=v=1.1_2\times 2^0. $$

Thus $u=v=\frac32$.

First compute $u\oplus v$:

$$ u+v=3=1.1_2\times 2^1, $$

which is exactly representable. Hence

$$ u\oplus v=3. $$

Therefore

$$ (u\oplus v)^2=9. $$

Now compute $u^2$:

$$ u^2=v^2=\left(\frac32\right)^2=\frac94 =1.001_2\times 2^1. $$

With precision $p=2$, the floating numbers in the interval $[2,4)$ are

$$ 1.0_2\times 2^1=2, \qquad 1.1_2\times 2^1=3. $$

Since

$$ \frac94=2.25 $$

is closer to $2$ than to $3$, rounding gives

$$ \operatorname{fl}(u^2)=2. $$

Hence

$$ u^2\oplus v^2 =2\oplus 2. $$

But

$$ 2+2=4=1.0_2\times 2^2 $$

is exactly representable, so

$$ u^2\oplus v^2=4. $$

Therefore

$$ 2(u^2\oplus v^2)=8. $$

Comparing the two sides,

$$ (u\oplus v)^2=9, \qquad 2(u^2\oplus v^2)=8, $$

and thus

$$ 9>8. $$

Hence

$$ \boxed{(u\oplus v)^2>2(u^2\oplus v^2)} $$

for

$$ \boxed{u=v=1.1_2\times 2^0}. $$

This provides the required example. ∎