You are on page 1of 3

Fall 2023 Computer Arithmetic H.

Wu

Answer to Assignment Two

1. +873.6410 = 934.44−10 and −873.6410 = 1287.76−10 .

2. 1389−10 + 4703−10 = 4072−10 and 1389−10 − 4703−10 = 18686−10 .

3. +10.2510 = +1010.012 = 11110.01−2 , and −10.2510 = −1010.012 = 1010.11−2 .

4. Solution:
A 1 1 0 1 −3
X × 1 0 0 1 −7
P (0) = 0 0 0 0 0
x0 = 1 ⇒ Add A + 1 1 0 1
1 1 0 1
Shift 1 1 1 0 1
x1 = 0 ⇒ Shift 1 1 1 1 0 1
x2 = 0 ⇒ Shift 1 1 1 1 1 0 1
x3 = 1 ⇒ Correction (Add − A) + 0 0 1 1
P = 0 0 1 0 1 0 1 = 2110
2

5. Solution:
Since X < D, we perform the division operation X ÷ D as follows:

r0 = X 0 .1 0 0 0 0 0
2r0 0 1 .0 0 0 0 0
Add − D + 1 1 .0 1 1
2r0 − D ≥ 0 0 0 .0 1 1 0 0 set q1 = 1
r1 = 2r0 − D and 2r1 0 0 .1 1 0 0
Add − D + 1 1 .0 1 1
2r1 − D > 0 0 0 .0 0 1 0 set q2 = 1
r2 = 2r1 − D and 2r2 0 0 .0 1 0
Add − D + 1 1 .0 1 1
2r2 − D < 0 1 1 .1 0 1 set q3 = 0
r3 = 2r2 0 0 .0 1 0

The final results are Q = (0.110)2 = 3/4 and r3 = 1/4 ⇒ R = rm 2−m = r3 2−3 = 1/32. 2

=1=
Fall 2023 Computer Arithmetic H. Wu

6. Solution:
Since X = 32 < 2n−1 D = 23 × 5 = 40, we perform the division operation X ÷ D using the
restoring division algorithm as follows,

r0 = X 0 1 0 0 0 0 0
2r0 0 1 0 0 0 0 0
Add − D + 1 1 0 1 1
r1 = 2r0 − D > 0 0 0 0 1 1 0 0 set q1 = 1
2r1 0 0 1 1 0 0
Add − D + 1 1 0 1 1
r2 = 2r1 − D > 0 0 0 0 0 1 0 set q2 = 1
2r2 0 0 0 1 0
Add − D + 1 1 0 1 1
2r2 − D < 0 1 1 1 0 1 set q3 = 0
r3 = 2r2 0 0 0 1 0

Therefore, Q = (110)2 = 610 and R = r3 = 102 = 210 . 2

7. Solution:

1).
−88.510 = −1011000.12 = −1.01100012 × 26 .

{z00 · · · 00}.
Then we have s = 1, e = 610 +12710 = 13310 = 1000 0101, and f = |0110 0010
23 bits

2).
0.187510 = 0.00112 = 1.12 × 2−3 .
Then we have s = 0, e = −310 + 12710 = 12410 = 0111 1100, and f = |1000 00
{z · · · 00}.
23 bits

8. Solution: Follow lecture notes §3.1 of Chapter 4 and the solution to the last problem, we have
s3 = s1 ⊕ s2 = 1, and

(1.) e3 = 13310 + 12410 − 12710 = 13010 = 1000 0010.


(2.) m3 = 1.01100012 × 1.12 = 10.000100112 = 1.0000100112 × 21 , and e3 = e3 + 1 =
10000010 + 1 = 10000011.

Therefore, IEEE single-precision floating point format for F1 × F2 is s3 e3 f3 , where


{z 00 · · · 00}.
s3 = 1, e3 = 1000 001, and f3 = |0000 1001 1000 2
23 bits

=2=
Fall 2023 Computer Arithmetic H. Wu

9. Solution:
The table can be shown as follows.

X = x1 x0 .x−1 Y = round(X)
×.0 ×
×.1 ×+1

The output Y can be given as Y = x1 x0 + x−1 . A block diagram (omitted) for this rounding
scheme can be easily drawn that uses two serial-connected FAs with the inputs x0 and x−1 for
the FA at the least significant bit location, and inputs x1 and 0 for the FA at the most significant
bit location. 2

10. Solution:

• Truth table:
ROM scheme with ℓ = 4 and d = 1
Input: Output: Error:
x ROM(x) ROM(x) − x
×000.0 ×000. 0
×000.1 ×001. +1/2
×001.0 ×001. 0
×001.1 ×010. +1/2
×010.0 ×010. 0
×010.1 ×011. +1/2
··· ··· ···
×111.0 ×111. 0
×111.1 ×111. −1/2
• Error and bias:
It can be seen from the above table that the maximal errors are e− +
max = −1/2 and emax =
+1/2.
1 1  1  3
Bias = 7× +8×0+1× − = .
16 2 2 16
2

=3=

You might also like