In: Computer Science
1-How is -89 represented using 8-bit two's compliment? (The answer should be 8 binary digits).
2-What is 10101100 - 00100100 using 2's compliment arithmetic? (The answer should be 8 binary digits)
3-Assume we are using the simple model for floating-point representation as given in the text (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 15, a normalized mantissa of 8 bits, and a single sign bit for the number):Show how the computer would represent the numbers 100.0 using this floating-point format. Express the answer in hexadecimal using 4 hex digits.
4-Show how 12.5 would be stored using IEEE-754 single precision. Express the answer as 8 hexadecimal digits
Q1
First, we represent 89 in binary then take its complement and add 1 to get the representation of -89 in 2's complement
So 89 in binary is 01011001
and we take its 1 complement and add 1 to it
(01011001)' +1 = 10100110+1=10100111
Q2
In 2's complement, we can do subtraction by taking 2's complement of the second number and add it to the first so the 2's complement of 00100100 is 11011100 and we add it to the first 10101100
So adding the two gives us
1010 1100
1101 1100
=10001000
Q3
Converting 100 to binary we get 1100100
converting it to normalized form we have 1.100100 * 2^6
So the exponent becomes 6 + 15 = 21 and the sign bit is 0 as the number is positive and the mantissa is value after decimal so 16 bit representation is
0 10101 10010000
So in hex the representation is
0001 0101 1001 0000 = 0x1590
Q4
12.5 = 0x41480000