The Student Room Group

Computer Science AS-Level Paper 1 - Question 2d

Can someone please help me to answer this question?

Show the denary number −2⅝ as a floating-point binary number with a 6-bit mantissa and 4-bit exponent, both stored using two’s complement representation.
Reply 1
−2⅝ is just wrote weird, is just 62.5% which is 0.625, meaning the entire denary number is just -2.625

the 6 bit mantissa and 4 bit exponent simply means your binary number will look like this 000000.0000 with 6 bits before the decimal point and 4 after
(the mantissa is the number being multiplied and the exponent being the power to which it is multiplied exactly like standard form)

you need to know fixed point to make sense of this part, you must first find out the positive binary number your trying to find using the below scale from fixed point binary where instead of doubling forward (1 2 4 8 16...) you instead half it going backwards (0.5 0.125 0.0625...):

-32, 16, 8, 4, 2, 1, . 1/2(0.5), 1/4(0.125), 1/8(0.0625), 1/16(0.03125)

your answer will be:
000010.1100 = 2 + 0.5 + 0.125 = 2.625

remember that 0.1 is positive and 1.0 is negative just like how 1 = negative and 0 = positive in other binary calculations

Although -2.625's is a negative number its magnitude is still larger than one so it will be a positive shift but will be a ending negative number

so as stated before find the positive value in binary = 000010.1100
as it is negative 2s compliment is needed, so flip it and add 1:
original number: 000010.1100
flip: 111101.1100
add 1: 111101.1101

now you need to shift the decimal place to put it into floating point, as the magnitude is more than 1 you need to positive shift it however it is also a negative number so we need to also move the decimal place to a position in the number which makes it a 1.0, note as its a positive shift you can only move forward.

we can see if we move the decimal point 2 points ahead we get the magic 1.0:
111.011101

now find the shift value in binary for the exponent: its positive 2 thus the sift is 0010

you now found everything now you just need to put it together for the answer:

the answer will start at the digit before the decimal point in our case its '1.0' and will continue throughout until you reach 8 bits (you may have to add 0s at the end to reach 8 bits) in our case the result is this:
1.0111010
(added an 0 at the end)

this needs to be added with our shift of 0010 (which is just +2 in binary) to get our final answer of:

1.0111010/0010

videos to help you in order of most helpful:
https://www.youtube.com/watch?v=nLCoYns0Gs4&ab_channel=iainprice
https://www.youtube.com/watch?v=sJXTo3EZoxM&ab_channel=TheOrganicChemistryTutor
https://www.youtube.com/watch?v=mGfOJQgdI_U&ab_channel=Craig%27n%27Dave
(edited 1 year ago)
Could someone help me to convert decimal value -23.25 into normalised floating point representation (mantissa and exponent)

Quick Reply

Latest