In: Computer Science
Show the decimal integer -143 in 10-bit sign magnitude, one's complement, two's complement and excess-511 respectively in the given order
-143 ------- This is negative. so, follow these steps to convert this to various binary formats. Divide 143 successively by 2 until the quotient is 0 143/2 = 71, remainder is 1 71/2 = 35, remainder is 1 35/2 = 17, remainder is 1 17/2 = 8, remainder is 1 8/2 = 4, remainder is 0 4/2 = 2, remainder is 0 2/2 = 1, remainder is 0 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 10001111 Adding 2 zeros on left hand side of this number to make this of length 10 So, 143 in normal binary format is 0010001111 sign-magnitude: ----------------- set 1 as left most bit, since this number is negative. so, 0010001111 becomes 1010001111 ======================================= || sign-magnitude: 1010001111 || ======================================= 1's complement: ----------------- flip all the bits. Flip all 0's to 1 and all 1's to 0. 0010001111 is flipped to 1101110000 ======================================= || 1's complement: 1101110000 || ======================================= 2's complement: ----------------- Add 1 to above result 1101110000 + 1 = 1101110001 ======================================= || 2's complement: 1101110001 || ======================================= excess-511: ------------ for excess 511, add 511 to -143 -143+511 = 368 convert 368 to 10-bit binary Divide 368 successively by 2 until the quotient is 0 368/2 = 184, remainder is 0 184/2 = 92, remainder is 0 92/2 = 46, remainder is 0 46/2 = 23, remainder is 0 23/2 = 11, remainder is 1 11/2 = 5, remainder is 1 5/2 = 2, remainder is 1 2/2 = 1, remainder is 0 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 101110000 Adding 1 zeros on left hand side of this number to make this of length 10 368 in binary is 0101110000 excess-511: 0101110000