Back

Conference Topic:

Select two decimal numbers between -60 and +60. Convert the numbers into 8 bit unsigned numbers with negative numbers in the 2's complement form. (Remember that positive numbers have the leftmost bit =0 and negative numbers have the leftmost bit =1).

Add the two numbers together to generate an eight-bit binary result. Show your work.

Response:

Theresa L. Ford on 03-19-2004

```Calculate 5010 + -4910.

1. Convert Decimals to Binary

1.A. 5010 = ?2

5010 = 010 + 010 + 3210 + 1610 + 010 + 010 + 210 + 010

0    0     1     1    0    0    1    0

5010 = 001100102

OR:

5010 / 210 = 2510 R 010

2510 / 210 = 1210 R 110
1210 / 210 =  610 R 010

610 / 210 =  310 R 010
310 / 210 =  110 R 110

110 / 210 =  010 R 110

Read from end to beginning ( 110010 ).
Pad left with zeros to 8 bits.  ( 00110010 ).

5010 = 001100102

1.B. -4910 = ?2 in 2's compliment form

-4910 = -12810 + 6410 + 010 + 010 + 810 + 410 + 210 + 110

1     1    0    0    1    1    1    1

-4910 = 110011112

4910 = 010 + 010 + 3210 + 1610 + 010 + 010 + 010 + 110

0    0     1     1    0    0    0    1

4910     = 001100012
Invert  = 110011102

-4910 = 110011112

5010 = 001100102
-4910 = 110011112

001100102
+ 110011112
12   1, no carry

1
001100102
+ 110011112
012   0, carry 1

11
001100102
+ 110011112
0012   0, carry 1

111
001100102
+ 110011112
00012   0, carry 1

1111
001100102
+ 110011112
000012   0, carry 1

11111
001100102
+ 110011112
0000012   0, carry 1

111111
001100102
+ 110011112
00000012   0, carry 1

111111
001100102
+ 110011112
000000012   0, overflow 1

000000012 = 110

010 + 010 + 010 + 010 + 010 + 010 + 010 + 110 = 110

3. Summary

5010    001100102
+ -4910   +110011112
110    000000012

```

Back