I'm trying to help someone out with some homework and I'm getting erroneous answers.
The question is this:
Represent 〖-0.109375〗_10 in normalized floating point representation having a 5-bit fractional two’s complement mantissa and a 3-bit integer two’s complement exponent.
I have written the following notes:
Let’s work out the answer to the question: 〖-0.109375〗_10 Step 1: Convert to binary.
0 0. 0 0 0 1 1 1 0 0
〖-(00.00011100)〗_2
Step 2: Multiply by 1 (2^0) 〖-(00.00011100)〗_2 x 2^0
Step 3: Shift to make mantissa whole number We need to make 6 shifts to the left Why? Because we have 0.000111 Shift 1 = 00.00111 Shift 2 = 000.0111 Shift 3 = 0000.111 Shift 4 = 00001.11 Shift 5 = 000011.1 Shift 6 = 0000111
Therefore we get, -(〖111〗_2) x 2^(-6)
Step 4: Convert mantissa. In this question we were requested to convert to two’s complement (5-bit fractional) Therefore we need to convert – 111 to two’s complement and make this 5 bit
Step A: Convert to one’s complement (5 bit) -00111 = 11000 Step B: Convert to two’s complement (5-bit) 11000 + 00001 = 〖11001〗_2
Step 5: Convert exponent top 2-bit two’s complement 2^(-6)
Therefore we need to convert -6 to binary (two’s complement) Step A: Convert to binary 1 1 0
Step B: Convert to one’s complement (3-bit) 110 = 001
Step C: Convert to two’s complement 010
The answer is then, 〖11001 010〗_2
As you can see, 2^-6 seems wrong for a 3-bit two's complement.
Can anyone point out what I might be doing wrong?