Binary Number System: Representations

Homework Solutions

Problem 1.a.  

      379 / 2   = 189 rem 1
                = 94 rem 1
                = 47 rem 0
                = 23 rem 1
                = 11 rem 1
                = 5 rem 1
                = 2 rem 1
                = 1 rem 0
                = 0 rem 1

Listing remainders from last to first gives, 101111011 

Padded to 16 bits, 0000000101111011


Problem 1.b. 0000000101111011 ==> 0000 0001 0111 1011 ==> 017B

Problem 1.c. Because the value is positive and because it requires less than 16 bits to represent, the result is the same as in b.

Problem 1.d. -476. Sign bit = 1 for a negative number. Magnitude: 476 / 2 = 238 rem 0 = 119 rem 0 = 59 rem 1 = 29 rem 1 = 14 rem 1 = 7 rem 0 = 3 rem 1 = 1 rem 1 =0 rem 1 111011100 for magnitude. 1 | padding | 111011100 ==> 1000000111011100 ==> 1000 0001 1101 1100 ==> 81DC

Problem 1.e. Because the value is positive and because it requires less than 16 bits to represent, the result is the same as in b.

Problem 1.f. 2's-complement of -476: magnitude 476: 111011100 pad to 16 bits: 0000000111011100 negative, so complement: 1111111000100011 then add 1: 1111111000100100 1111 1110 0010 0100 ==> FE24

Problem 1.g. 14 + 127 = 141 So, the value +14 encodes as 141 in offset-127 (Note: offset-127 encoding uses an 8-bit result) 141 ==> 10001101 ==> 1000 1101 ==> 8D



Problem 2.a. the unsigned binary integer 000012AF 0001 0010 1010 1111 ==> 1001010101111 ==> 4096 + 512 + 128 + 32 + 8 + 4 + 2 + 1 = 4783

Problem 2.b. the sign-magnitude binary integer 80001876 1000 0000 0000 0000 0001 1000 0111 0110 The leading 1 tells us that it's a 31-bit negative number with magnitude: 000 0000 0000 0000 0001 1000 0111 0110 1100001110110 ==> 4096 + 2048 + 64 + 32 + 16 + 4 + 2 = 6262 So the value represented is -6262

Problem 2.c. the 2's-complement binary integer FFFFFFFF 1111 1111 1111 1111 1111 1111 1111 1111 The leading 1 tells us that it's a 31-bit negative number, so complement and add 1: complement: 0000 0000 0000 0000 0000 0000 0000 0000 add 1: 0000 0000 0000 0000 0000 0000 0000 0001 So the number represented is -1.



Problem 3. To compute the sum, first convert to binary: ABCD ==> 1010 1011 1100 1101 1234 ==> 0001 0010 0011 0100 Then add the bits: 1010 1011 1100 1101 + 0001 0010 0011 0100 --------------------- 1011 1110 0000 0001 Now convert back to hexadecimal: 1011 1110 0000 0001 B E 0 1 Thus, ABCD + 1234 = BE01 in hexadecimal.