COMP SCI 241 Discrete Mathematics I Homework #4 As always, show your work/reasoning Fall 2006 F. Baulieu 1) Put the value 302 into 16-bit twos complement form: 302 is positive, so we simply put it into binary and pad to 16 bits. We'll convert to hex and then to binary, and then pad: 0 r1 1 r2 16 16 18 16 r14 302 So 302 = 12E16 = 0001 0010 11102 =0000 0001 0010 11102 2) Put the value –2006 into 16-bit twos complement form: –2006 is negative, so we will put 2006 into 16-bit binary and then take the twos complement. We'll use the intermediate hex conversion again to speed up the process: 16 16 16 0 r7 7 r13 125 r6 2006 So 2006 = 7D616 = 0111 1101 01102 = 0000 0111 1101 01102 Taking the twos complement: 0000 0111 1101 0110→ 1111 1000 0010 1001 +1 1111 1000 0010 10102c So -2006 = 1111 1000 0010 10102c 3) Find the value of the 8-bit twos complement form number 101110012c Since this string starts with a 1, it is a negative value. We take the twos complement to find the binary form of the value's absolute value, and then convert from binary to decimal, remembering to put the minus sign in front: 1011 1001 → 0100 0110 +1 0100 01112 = 64 + 4 + 2 + 1 = 7110 So the given twos complement form number has value –71 4) Trina added the two 8-bit twos complement representations of the values 101 and 88, and when she converted the answer from twos complement to decimal, she got –67. Assuming she did all the arithmetic correctly, explain what is wrong. While 101 and 88 can be represented in 8 – twos complement, their sum, 189, does not fall in the 7 7 allowed range of 2 1 to 2 1 (–127 to +127). Therefore, Trina's computed result could not be the 8-bit twos complement form of 189.