TAOCP 4.2.2 Exercise 18

In unnormalized arithmetic, floating point addition and multiplication are still defined by but numbers need not be normalized.

Section 4.2.2: Accuracy of Floating Point Arithmetic

Exercise 18. [M40] In unnormalized arithmetic is there a suitable number $e$ such that

$$u \otimes (v \oplus w) \approx (u \otimes v) \oplus (u \otimes w) \quad {e}\ ?$$

Verified: yes
Solve time: 2m11s


Setup

In unnormalized arithmetic, floating point addition and multiplication are still defined by

u\otimes v=\operatorname{round}(uv),$$ but numbers need not be normalized. Let the radix be $b$ and the precision be $p$. The question asks whether there exists a number $e$ such that the distributive law is approximately valid in the sense $$u\otimes(v\oplus w)\approx (u\otimes v)\oplus(u\otimes w)\qquad{e}.$$ Here ${e}$ refers to the approximate-equality relation introduced in this section: two numbers are considered approximately equal when their relative difference is bounded by $e$. We must determine whether a universal constant $e$ exists for unnormalized arithmetic. ## Solution No such number $e$ exists. The reason is that unnormalized arithmetic admits arbitrarily large relative errors. Consider radix $10$ with precision $p=8$ for concreteness. Let $$u=1,\qquad v=10^N,\qquad w=1,

where $N$ is arbitrarily large.

Since unnormalized numbers are permitted, the exact sum

$$$$

is rounded to

$$$$

because the added unit lies beyond the eighth significant digit.

Hence

$$ =1\otimes10^N =10^N. $$

On the other hand,

$$ u\otimes w=1, $$

so

$$ (u\otimes v)\oplus(u\otimes w) =10^N\oplus1 =10^N. $$

This example gives exact agreement, so a different choice is needed.

Take instead

$$ v=1,\qquad w=10^{-N}. $$

Then

$$$$

because $10^{-N}$ is lost in rounding when $N$ is sufficiently large. Therefore

$$ =10^N\otimes1 =10^N. $$

But

$$$$

and

$$ =10^N\otimes10^{-N} =1. $$

Hence

$$ (u\otimes v)\oplus(u\otimes w) =10^N\oplus1. $$

In unnormalized arithmetic, the rounded value of $10^N+1$ is represented as

$$$$

provided that the result contains at most $p$ digits. Since unnormalized representations permit leading zeros in the fraction, numbers of the form

$$$$

may be represented exactly even when $N$ is arbitrarily large.

Thus

$$ (u\otimes v)\oplus(u\otimes w) =10^N+1, $$

while

$$ u\otimes(v\oplus w)=10^N. $$

The relative discrepancy is

$$ \frac{|(10^N+1)-10^N|}{10^N} =10^{-N}. $$

This tends to $0$, so it does not yet disprove existence of $e$.

To obtain a contradiction, choose instead

$$ v=10^{-N},\qquad w=-10^{-N}+10^{-2N}. $$

Then

$$ v+w=10^{-2N}. $$

Since this quantity is too small to survive rounding,

$$ v\oplus w=0. $$

Therefore

$$ u\otimes(v\oplus w)=0. $$

Now

$$ u\otimes v=1, $$

while

$$ u\otimes w =-1+10^{-N}. $$

Hence

$$ (u\otimes v)\oplus(u\otimes w) =1\oplus(-1+10^{-N}) =10^{-N}, $$

because the cancellation leaves an exactly representable quantity.

Thus

$$ u\otimes(v\oplus w)=0, \qquad (u\otimes v)\oplus(u\otimes w)=10^{-N}. $$

The left-hand side is zero and the right-hand side is nonzero. Their relative difference is therefore unbounded; indeed no finite bound $e$ can satisfy

$$ 0\approx 10^{-N}\qquad{e}. $$

Since $N$ may be chosen arbitrarily large, any proposed universal value of $e$ fails for sufficiently large $N$.

Consequently there is no number $e$ for which

$$ u\otimes(v\oplus w)\approx (u\otimes v)\oplus(u\otimes w) \qquad{e} $$

holds for all $u,v,w$ in unnormalized arithmetic.

Verification

The construction uses only the defining property of unnormalized rounding: quantities of sufficiently different magnitudes may disappear when added.

The choice

$$ v=10^{-N},\qquad w=-10^{-N}+10^{-2N} $$

forces

$$ v\oplus w=0, $$

while multiplication by $u=10^N$ magnifies the discarded quantity to

$$ u(v+w)=10^{-N}, $$

which survives exactly after the separate products are formed and added.

Hence one side of the distributive law becomes $0$ and the other becomes $10^{-N}$. No relative-error tolerance ${e}$ can identify a nonzero number with $0$ uniformly.

Notes

The normalized arithmetic studied in the text admits the uniform relative-error estimate (18), because normalization prevents arbitrarily large relative errors in a single operation. Unnormalized arithmetic lacks such a bound. The counterexample above exploits that fact directly. Therefore the distributive law cannot be rescued by any universal approximate-equality constant. Thus the answer is

$$ \boxed{\text{No such } e \text{ exists.}} $$