You are on page 1of 3

You are asked to perform addition and subtraction operations on two BCD numbers, 766

and 673. Use four-digit, signed 9s-complement forms and perform the following
operations and show the range of signed integers that can be represented in this
scheme.
Show all the intermediate steps and indicate whether there is an overflow or not.

Range for 4-bit 9s complement form: [-104-1+1, 104-1-1].


Range for 4-bit 10s complement form: [-104-1, 104-1-1].

a)

+766
+673

+
-----------

0766
0673

+
----------1439

Adding two values is straight forward. Simply align the values on the least significant
bit and add, propagating any carry to the bit one position left.
Adding two positive numbers should yield a positive number. Thus, the sign bit of the
result should be 0. However, here, we got 1 as the sign bit, which actually does not
correspond to either a positive or a negative sign bit. Therefore, there is an overflow.
b)

+766
-673

+
-----------

9999
673

----------9326

0766
9326

+
----------10092
1 end-around borrows
+
-----------0093

Subtraction is similar, except that borrows are propagated to the left instead of
carries. If the borrow extends past the end of the word it is said to have "wrapped"
around, a condition called an "end-around borrow". When this occurs, the bit must be
added back in at the right-most bit. This phenomenon does not occur in r's
complement arithmetic.
Since it is a positive number, the result is 93 in both 9s complement and 10s
complement forms.

c)
-766
+673

+
-----------

9999
766

----------9233

9233
0673

+
----------9906

Since the result is a negative number, its representation will differ in 9s complement
and 10s complement forms.
We have done the addition operation in 9s complement form, so 9906 is the correct
answer for 9s complement form. If we convert it back to base 10, then it would give us
-93 (9999-9906).
If we want to represent the result in 10s complement form, then we should convert it
to that form by just adding 1 to the result. Thus, the correct result of the addition will
be 9907 in 10s complement form. If we convert it back to base 10, then it would give us
-93 (10000-9907).

d)
-766
-673

+
-----------

9233
9326

+
----------18559
1
+
-----------8560

end-around borrows

Adding two negative numbers should yield a negative number. Thus, the sign bit of the
result should be 9. However, here, we got 8 as the sign bit, which actually does not
correspond to either a positive or a negative sign bit. Therefore, there is an overflow.
Since there is an overflow in the result, we do not need to show how to represent it in
10s complement form.

e)
-666
-333

+
-----------

9333
9666

+
----------18999
1
+
-----------9000

end-around borrows

Since the result is a negative number, its representation will differ in 9s complement
and 10s complement forms.
We have done the addition operation in 9s complement form, so 9000 is the correct
answer for 9s complement form. If we convert it back to base 10, then it would give us
-999 (9999-9000).
If we want to represent the result in 10s complement form, then we should convert it
to that form by just adding 1 to the result. Thus, the correct result of the addition will
be 9001 in 10s complement form. If we convert it back to base 10, then it would give us
-999 (10000-9001).

You might also like