A
|
B
| |
a.
|
3174
|
0522
|
b.
|
4165
|
1654
|
Binary conversions:
A
|
B
| |
a.
|
011 001 111 100
|
000 101 010 010
|
b.
|
100 001 110 101
|
001 110 101 100
|
3.1.1 What is the sum of A and B if they represent unsigned 12-bit octal numbers? The result should be written in octal.
a)
3174 +
0522
3716
011 001 111 100 +
000 101 010 010
011 111 001 110
3 7 1 6
b)
4165 +
1654
6041
100 001 110 101+
001 110 101 100
110 000 100 001
6 0 4 1
3.1.2 What is the sum of A and B if they represent signed 12-bit octal numbers stored in sign-magnitude format? The result should be written in octal.
In sign-magnitude format, the first bit represents the sign. 1 is neg, 0 is pos
a. since the leading bit is 0, the sum is identical
3174 +
0522
3716
011 001 111 100 +
000 101 010 010
011 111 001 110
3 7 1 6
b.
4165 - 100 001 110 101 leads with a 1, so is negative.
000 001 110 101
0 1 6 5
the negative changes our sum to subtraction
1654 -
0165
1467
001 110 101 100 -
000 001 110 101
001 100 110 111
1 4 6 7
3.1.3 Convert A into a decimal number, assuming it is unsigned.
See spreadsheet
https://docs.google.com/spreadsheet/ccc?key=0Anpg-UsmVkpFdDVPOHo3T2V2cGowLVh1Y2N1d1pWR2c&usp=sharing
I put up a long hand conversion of binary to decimal.
bit*(2^11) + bit*(2^10) … + bit *(2^0)
a. 1660
b. 2165
A
|
B
| |
a
|
7040
|
0444
|
b
|
4365
|
4312
|
Binary Conversions
A
|
B
| |
a
|
111 000 100 000
|
000 100 100 100
|
b
|
100 011 110 101
|
100 011 001 010
|
3.1.4 What is A – B if they represent unsigned 12-bit octal numbers? The result should be written in octal.
a)
7040 -
0444
6374
111 000 100 000 -
000 100 100 100
110 011 111 100
b)
4365 -
4312
0053
100 011 110 101 -
100 011 001 010
000 000 101 011
3.1.5 What is A – B if they represent signed 12-bit octal numbers stored in sign-magnitude format? The result should be written in octal.
a)
7 = 111, so its negative
011 000 100 000
3 0 4 0
3040 +
0444
3504
3 = 011
add the sign bit back in
111 = 7
7504
011 000 100 000 +
000 100 100 100
011 101 000 100
add sign bit
111 101 000 100
7 5 0 4
b)
4365 and 4312 both start with the bit pattern
100
therefore they are both treated as negatives
0365 -
0312
0053
add the sign bit back in
4053
000 011 110 101 -
000 011 001 010
000 000 101 011
add sign bit back in
100 000 101 011
4 0 5 3
3.1.6 Convert A into a binary number. What makes base 8 (octal) an attractive numbering system for representing values in computers?
I converted these numbers as part of proofs in my work as I went.
As for what makes base 8 attractive:
When Computers first started to come out, Octal was ideal to represent a word. In more recent times, win 16/32/64 bit machines, hex has taken precedence since you have 5 bit sets and 1 bit as most significant to make a 16 bit word. However, it is still used in some instances, such as chmod in unix because it doesn’t use symbols.
Octal, since it uses 3 binary bits, 0-7 decimal, is easy to convert mentally, which makes math calculations, such as the ones above, relatively pain free.
As a side note, apparently the Yuki language employs an octal system because they count the space between fingers, instead of fingers themselves.
No comments:
Post a Comment