In: Computer Science
Show the decimal integer 79 in 8-bit sign magnitude, one's complement, two's complement and excess-127 respectively in the given order, separated by comma.
Answer: -------- 01001111,01001111,01001111,11001110 Explanation: ------------- 79 ----- Since this is a positive number. we can directly convert this into binary Divide 79 successively by 2 until the quotient is 0 > 79/2 = 39, remainder is 1 > 39/2 = 19, remainder is 1 > 19/2 = 9, remainder is 1 > 9/2 = 4, remainder is 1 > 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 1001111 So, 79 of decimal is 1001111 in binary Adding 1 zero(s) on left hand side of this number to make this of length 8 So, 79 in normal binary format is 01001111 ===================================== || 1's complement: 01001111 || || 2's complement: 01001111 || || sign-magnitude: 01001111 || ===================================== for excess-127: --------------- for binary value add 127 to 79 127+79 = 206 Divide 206 successively by 2 until the quotient is 0 > 206/2 = 103, remainder is 0 > 103/2 = 51, remainder is 1 > 51/2 = 25, remainder is 1 > 25/2 = 12, remainder is 1 > 12/2 = 6, remainder is 0 > 6/2 = 3, remainder is 0 > 3/2 = 1, remainder is 1 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 11001110 So, 206 of decimal is 11001110 in binary ================================= || excess-127: 11001110 || =================================