The Student Room Group

Two's complement floating point number

I'm currently revising for the AQA CPT4 exam, working threw past papers.

Two's complement has just gone out my mind, so can someone walk me threw this question please.

The binary pattern 1001 0111 0100 can represent different numbers.

State its value in denary if it represents a normalised two’s complement floating
point number with an eight bit mantissa followed by a four bit exponent.

Thank you in advance for any help
The binary pattern 1001 0111 0100 can represent different numbers.

State its value in denary if it represents a normalised two’s complement floating
point number with an eight bit mantissa followed by a four bit exponent.


normalised means 12.3 is converted to 1.23 times 10^1


1001 0111 number (could be -105 so -1.05)

0100 exponent =10^4
Do you have the answer? - from what I can remember it's 7.25.
Reply 3
The answer, from the AQA mark scheme is

-13.125
bluehell555
The answer, from the AQA mark scheme is

-13.125

Oh right, I remember how to do it now...

Split the bits into the mantissa and exponent:
(note that I've just used a ~ to separate them it doesn't mean anything. On the paper I'd draw a vertical line).

M E
1001 0111 ~ 0100


work out the exponent as if it was a two's complement number. In this case it's 4:

M E
1001 0111 ~ 0100
~ 4

as it's a normalised two's complement number, the binary point is after the first significant bit:

M E
1.001 0111 ~ 0100
~ 4

shift the binary point 4 places (as the exponent is 4)

M E
1001 0.111 ~ 0100
~ 4

work out the integer part remembering the number is in twos complement form so the first bit will be negative:
(-16)+2 = -14
add on the decimal part:
-14 + (1/2) + (1/4) + (1/8) = -13.125
Reply 5
Thank you, all comes flooding back now it has been explained, prob won't even be a question on it now, lol.
bluehell555
Thank you, all comes flooding back now it has been explained, prob won't even be a question on it now, lol.

No problem :smile: Good luck in the exam.
Reply 7
In order to have 2 complements does the MSB have to be 1?
Sithius
In order to have 2 complements does the MSB have to be 1?

I think, in order for it to be normalised, yes it does. As you have to shift the bits as far left as possible, thus giving the possibility for greater precision using the other bits to the right.

That's how I remember it anyway, might be a good idea to check with your teacher though. I don't think the exam goes into much depth about normalisation of two's complement though, more about converting it to deanery.
Reply 9
Well I had my exam this morning, it was bloody hard! :frown:

Think I failed.

Latest

Trending

Trending