2. Data Representation Flashcards
Convert 0000 10112 to base 10.
11
MIPS words are 32 bits in length. What is the range of unsigned integers representable in 1 word?
0 to 232-1
Write -21 in 8-bit sign-magnitude form.
1 001 0101
State two disadvantages of sign magnitude form over two’s complement.
- There is a positive and negative zero.
- Adders need an extra step to work out the sign.
State an advantage of sign-magnitude form over two’s complement.
It is symmetric.
Convert 1111 11002 (sign-magnitude) to base 10.
-124
Convert 1111 11002 (2’s complement) to base 10.
-4
Derive the ‘shortcut’ method for converting to two’s complement.
We can see that the inversion of a binary representation (xi) satisfies:
x + xi = -1
which implies:
-x = xi + 1
Describe one’s complement notation.
One’s complement is just a flip of bits to convert to negative. In other words, it is one less than the two’s complement.
Convert eca8 6420 16 to binary.
1110 1100 1010 1000 0110 0100 0010 0000
Convert 0001 0011 0101 0111 1001 1011 1101 1111 from binary to hexadecimal.
1357 9bdf
State the range of signed integers in two’s complement.
-2n-1 to -2n-1 - 1
Describe the process of sign extending a 16-bit binary number to a 32 bit binary number.
The msb (most significant bit) is copied into the 16 new bits at the start of the numbers.
Explain the difference between logical right shift and arithmetic right shift. Why is there solely a left-shift?
Logical right shift fills in the spare bits with the msb, and arithmetic right shift fills it in with 0s. Left shift is always filled with 0s.
Why can an overflow not occur when the operands have different signs?
Because the magnitude of the result is smaller than those of the operands, the result will fit in the size the operands are.
When does an overflow occur in a binary addition?
When the (msb)s of the operands are the same, and both opposite to the msb of the result.
Normalize 0.1 x 10-8.
1 x 10-9.
In 1.xxxxxx x 2yyyyyyy, what are xxxx and yyyy?
xxxx is the ‘fraction’ or ‘mantissa’, and yyyy is the ‘exponent’.
In IEEE 754, why is the exponent placed before the mantissa?
To make sorting simpler.
Explain the reasoning behind (exponent - bias) in IEEE 754.
Negative exponents cause sorting to be harder, and so we wish to have the most negative exponent as 0000 0000 and the most positive as 1111 1111. To do this, we add 127 to the exponent. (Double precision is 1023)
What is -0.75 in IEEE 754 binary representation?
1 0111 1110 1000 0000 0000 0000 0000 000
What is 1 1000 0001 0100 0000 0000 0000 0000 000
-5
An exponent and mantissa of zero means….
An exponent of 255 and a mantissa of 0 means….
An exponent of 255 and a mantissa non-zero means….
a. 0
b. Infinity
c. NaN