1
votes

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?

1

1 Answers

1
votes

Usually the significand (not mantissa1) is shifted so the most significant one bit is in a certain position, not so the significand is an integer. The IEEE 754 format normalizes the significand to 1.ddd…d, where each d is a digit in the base being used.

Shifting your value to move the first one bit to that position yields an exponent of –4. You would have –1.1102•2–4. To represent the significand in two’s complement, we add another bit on the left, producing –01.1102•2–4, and then apply the negation to yield 10.010 for the significand and 100 for the exponent.

However, there can be some variation on details. Is the significand normalized to 1.ddd…d or .1ddd…d? Is the significand five bits before adding a sign bit or after?

Do you have examples of values with known representations in this format? Or more details about the format?


1“Significand” is the preferred term. A significand is linear; a mantissa is logarithmic.