Math 4330, Homework 1, 1/22/2014

advertisement
Math 4330, Homework 1, 1/22/2014
1
1. Without converting to base-10, add the binary numbers 101100011112 and 110101000102 .
Solution:
1
1
1
1
1
1
1
1 0 1 1 0 0 0 1 1 1 1
1 1 0 1 0 1 0 0 0 1 0
1 1 0 0 0 0 1 1 0 0 0 1
2. Without converting to base-10, multiply the numbers 10112 and 1102 .
Solution:
1
0
1
0 0
1 0 1
1 0 1 1
1 0 0 0 0
1 1
1 0
0 0
1
1
0
3. Convert the numbers above to base-10 and check your results.
Solution:
For problem 1,
101100011112 = 1 + 2 + 4 + 8 + 128 + 256 + 1024 = 1423,
110101000102 = 2 + 32 + 128 + 512 + 1024 = 1698,
1100001100012 = 1 + 16 + 32 + 1024 + 2048 = 3121 = 1423 + 1698,
so the binary arithmetic is correct.
For problem 2, 10112 = 1 + 2 + 8 = 11 and 1102 = 2 + 4 = 6. We find that 10000102 =
2 + 64 = 66 = 11 · 6.
4. Represent the numbers 104 and −36 in 8-bit two’s complement notation. Add these
representations (ignoring overflow), then convert the result back to base-10. Check your
answer (it should be 68).
Solution:
The 8-bit two’s complement representation of 104 is 011010002 . For the other, we have
256 − 36 = 220 = 110111002 . Adding these, and ignoring the overflow (e.g., the highest
carry):
1
c
This document is copyright 2014
Chris Monico, and may not be reproduced in any form without
written permission from the author.
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
1
0
1
1
0
Indeed, 010001002 = 4 + 64 = 68 = 104 + (−36).
2
0
1
1
0
0
0
0
0
0
Download