4.2.1 ANSWERS TO EXERCISES 569 6. (Business web site) (Consider the
4.2.1 ANSWERS TO EXERCISES 569 6. (Consider the case ezL = cur fU = -fv in Program A.) Register A retains its previous sign, as in ADD. 7. Say that a number is normalized iff it is zero or its fraction part lies in the range Q < IfI < 4. A (p + 1)-place accumulator suffices for addition and subtraction; rounding (except during division) is equivalent to truncation. A very pleasant system indeed! We might represent numbers with excess-zero exponent, inserted between the first and subsequent digits of the fraction, and complemented if the fraction is negative, so that fixed-point order is preserved. 8. (a) (06, +.12345679) $ (06, –.12345678), (01, +.10345678) $ (00, -.94000000); (b) (99, +X7654321) $ itself, (99, +.99999999) @ (91, +.50000000). 9. a = c = (-50, +.lOOOOOOO), b = (-41, +.20000000), d = (-41, +.80000000), y = (11, +.looooooo). 10. (50, +.99999000) @ (55, +.99999000). 11. (50, +.10000001) @ (50, +.99999990). 12. If 0 < lfvl < IfUl, then lfvl I IfvI-bb-p; hence l/b < Ifu/fvl 5 l-b-p/lfvJ < 1-bpP. If 0 < lfvl 5 IfiLl, we have l/b < Ifu/f,,l/b 5 ((l-b-p)/(l/b))/b = l-bmP. 13. See J. Michael Yohe, IEEE Transactions C-22 (1973), 577-586; cf. also exercise 4.2.2-24. 14. FIX STJ 9F Float-to-fix subroutine: STA TEMP LDl TEMP(EXP) rI1 + e. SLA 1 rA+fffffO. JAZ 9F Is input zero? DECl 1 CMPA =0= (1: 1) If leading byte is zero, JE q-4 shift left again. ENNI -Q-4,1 JIN FIXOVFLO Is magnitude too large? ENTX 0 SHAX 0,l CMPX =1//2= JL 9F JG *+2 JAO 9F STA *+1 (0 : 0) Round, if necessary. INCA 1 Add &l (overflow is impossible) 9H JMP * Exit from subroutine. 1 15. FP STJ EXITF Fractional part subroutine: JOV OFLO Ensure overflow is off. STA TEMP TEMP t u. ENTX 0 SLA 1 rA t fU.