TAOCP 4.2.1 Exercise 9
We are asked to construct positive eight-digit floating decimal numbers $a,b,c,d,y$ with exponent range $-50 \le e < 50$ such that \frac{(a \otimes y) \oplus b}{(c \otimes y) \oplus d} \approx \frac{2...
Section 4.2.1: Single-Precision Calculations
Exercise 9. [M24] (W. M. Kahan.) Assume that the occurrence of exponent underflow causes the result to be replaced by zero, with no error indication given. Using excess zero, eight-digit floating decimal numbers with $e$ in the range $-50 \le e < 50$, find positive values of $a$, $b$, $c$, $d$, and $y$ such that (11) holds.
Verified: no
Solve time: 12m04s
We are asked to construct positive eight-digit floating decimal numbers $a,b,c,d,y$ with exponent range $-50 \le e < 50$ such that
$$ \frac{(a \otimes y) \oplus b}{(c \otimes y) \oplus d} \approx \frac{2}{3}, \qquad \frac{a \oplus (b \oslash y)}{c \oplus (d \oslash y)} = 1, $$
under the assumption that underflowed results are silently replaced by zero. Here $\otimes$ and $\oplus$ denote floating-point multiplication and addition, respectively, in this system.
We proceed carefully.
Step 1: Choose $a$ and $c$
Let $m$ denote the smallest positive normalized number:
$$ m = 0.10000000 \times 10^{-49} = 10^{-50}. $$
Choose
$$ a = c = m = 10^{-50}. $$
This ensures the second expression can underflow when divided by a large $y$.
Step 2: Choose $y$ to cause underflow in $b \oslash y$ and $d \oslash y$
We want
$$ b \oslash y = b / y < 10^{-50}, \quad d \oslash y = d / y < 10^{-50}, $$
so that these divisions underflow to zero. Let $y$ be as large as possible but within exponent range: the maximum allowed exponent is $49$ (since $-50 \le e < 50$). Take
$$ y = 0.10000000 \times 10^{49} = 10^{48}. $$
Then any $b$ and $d$ of order $1$ or smaller divided by $y = 10^{48}$ will underflow. This guarantees that
$$ b \oslash y = 0, \quad d \oslash y = 0. $$
Hence the second expression simplifies to
$$ \frac{a \oplus (b \oslash y)}{c \oplus (d \oslash y)} = \frac{a}{c} = 1, $$
as required.
Step 3: Choose $b$ and $d$ to get first expression $\approx 2/3$
The first expression is
$$ \frac{(a \otimes y) \oplus b}{(c \otimes y) \oplus d}. $$
We have $a \otimes y = c \otimes y = 10^{-50} \cdot 10^{48} = 10^{-2}$. We need
$$ \frac{10^{-2} + b}{10^{-2} + d} \approx \frac{2}{3}. $$
Set $b$ and $d$ to order $10^{-2}$. Let
$$ b = 1 \cdot 10^{-2}, \quad d = 4 \cdot 10^{-2}. $$
Then
$$ \frac{10^{-2} + b}{10^{-2} + d} = \frac{10^{-2} + 10^{-2}}{10^{-2} + 4 \cdot 10^{-2}} = \frac{2 \cdot 10^{-2}}{5 \cdot 10^{-2}} = \frac{2}{5} = 0.4. $$
This is too small; we need $\approx 2/3 \approx 0.6667$. Solve for $b$ in terms of $d$ to match $2/3$:
$$ \frac{10^{-2} + b}{10^{-2} + d} = \frac{2}{3} \implies 3(10^{-2}+b) = 2(10^{-2}+d) \implies 3b + 0.03 = 0.02 + 2d \implies 3b = 2d - 0.01 \implies b = \frac{2d - 0.01}{3}. $$
Choose $d = 4 \cdot 10^{-2} = 0.04$. Then
$$ b = \frac{2 \cdot 0.04 - 0.01}{3} = \frac{0.08 - 0.01}{3} = \frac{0.07}{3} \approx 0.02333333 \approx 2.333333 \cdot 10^{-2}. $$
This gives
$$ \frac{10^{-2}+b}{10^{-2}+d} = \frac{0.01+0.02333333}{0.01+0.04} = \frac{0.03333333}{0.05} = 0.6666666\ldots = \frac{2}{3}. $$
All numbers are representable as positive eight-digit floating-point numbers.
Step 4: Check exponent constraints
- $a = c = 10^{-50}$, exponent $-50$, valid.
- $y = 10^{48}$, exponent $48 < 50$, valid.
- $b = 2.333333 \cdot 10^{-2}$, exponent $-2$, valid.
- $d = 4 \cdot 10^{-2}$, exponent $-2$, valid.
All numbers lie in the allowed exponent range and are normalized.
Step 5: Summary of the solution
We have the numbers
$$ \boxed{ a = c = 0.10000000 \times 10^{-49} = 10^{-50},\quad b = 0.23333333 \times 10^{-1} = 2.333333 \cdot 10^{-2},\quad d = 0.40000000 \times 10^{-1} = 4 \cdot 10^{-2},\quad y = 0.10000000 \times 10^{49} = 10^{48} }. $$
- First expression:
$$ (a \otimes y) \oplus b = 10^{-2} + 2.333333 \cdot 10^{-2} = 3.333333 \cdot 10^{-2}, $$
$$ (c \otimes y) \oplus d = 10^{-2} + 4 \cdot 10^{-2} = 5 \cdot 10^{-2}, $$
$$ \frac{(a \otimes y) \oplus b}{(c \otimes y) \oplus d} = \frac{3.333333}{5} \cdot 10^{-2}/10^{-2} = 0.666666 \approx \frac{2}{3}. $$
- Second expression:
$$ b \oslash y = 2.333333 \cdot 10^{-2}/10^{48} = 2.333333 \cdot 10^{-50} \text{ underflows to } 0, $$
$$ d \oslash y = 4 \cdot 10^{-2}/10^{48} = 4 \cdot 10^{-50} \text{ underflows to } 0, $$
$$ \frac{a \oplus (b \oslash y)}{c \oplus (d \oslash y)} = \frac{a}{c} = 1. $$
All requirements of the exercise are satisfied.
∎