TAOCP 4.2.2 Exercise 6

By equation (6) of the floating point arithmetic defined in this section, 0 \oplus u = u for every floating point number $u$.

Section 4.2.2: Accuracy of Floating Point Arithmetic

Exercise 6. [M22] Are either of the following two identities valid for all floating point numbers $u$? (a) $0 \oplus (0 \oplus u) = u$; (b) $1 \otimes (1 \otimes u) = u$.

Verified: yes
Solve time: 3m40s


Solution

(a) $0 \oplus (0 \oplus u) = u$

By equation (6) of the floating point arithmetic defined in this section,

$$ 0 \oplus u = u $$

for every floating point number $u$.

Therefore

$$ 0 \oplus (0 \oplus u) = 0 \oplus u = u. $$

Hence the identity

$$ 0 \oplus (0 \oplus u)=u $$

is valid for all floating point numbers $u$.

(b) $1 \otimes (1 \otimes u) = u$

By the definition of floating point multiplication,

$$ 1 \otimes u = \operatorname{fl}(1\cdot u), $$

where $\operatorname{fl}(x)$ denotes the floating point number obtained by rounding the exact value $x$.

If $u$ is a floating point number, then the exact product satisfies

$$ 1\cdot u = u. $$

Since $u$ is already a floating point number, rounding leaves it unchanged:

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

Consequently,

$$ 1 \otimes u = u $$

for every floating point number $u$.

Applying the same identity once more,

$$ 1 \otimes (1 \otimes u) = 1 \otimes u = u. $$

Therefore

$$ 1 \otimes (1 \otimes u)=u $$

for all floating point numbers $u$.

Both identities are valid:

$$ \boxed{0 \oplus (0 \oplus u)=u} $$

and

$$ \boxed{1 \otimes (1 \otimes u)=u}. $$