TAOCP 4.2.1 Exercise 6
The question asks for the sign of register A when a floating point addition produces the value zero.
Section 4.2.1: Single-Precision Calculations
Exercise 6. [20] If the result of a FADD instruction is zero, what will be the sign of rA, according to the definitions of MIX's floating point attachment given in this section?
Verified: yes
Solve time: 1m41s
Solution
The question asks for the sign of register A when a floating point addition produces the value zero.
Program A performs floating point addition by adding the aligned fractions in line 23. If the result is zero, control reaches the normalization routine at label NORM. The first instruction of the normalization routine is
43 NORM JAZ ZR0
which corresponds to step N1 of Algorithm N: if $f=0$, the result is treated as zero and packed in the special normalized zero representation.
The convention stated in Section 4.2.1 is that a normalized floating point number is either one whose leading fraction digit is nonzero, or else $f=0$ and the exponent is at its smallest possible value. Thus zero has a unique floating point representation. Since the representation is unique, there cannot be both a positive and a negative zero.
In MIX arithmetic, whenever an operation yields the numerical value $0$, the sign is taken to be positive. The normalization routine therefore packs the zero result with the unique zero representation, whose sign is $+$.
Hence, if a FADD instruction produces zero, register A will contain
$$ (0,,+0), $$
that is, a positive zero.
Therefore the sign of $\mathtt{rA}$ is
$$ \boxed{+}. $$
∎