Floating-Point Conversions (Cambridge (CIE) A Level Computer Science): Revision Note
Exam code: 9618
Denary to floating-point binary
How do you convert denary to floating-point binary?
For the following conversions we are assuming:
12-bit mantissa (in two’s complement)
4-bit exponent (in two’s complement)
Convert +5.25 to floating-point binary
Step 1: Convert 5.25 to binary
5 = 101
0.25 = 0.01
→ 5.25 in binary = 101.01
Step 2: Normalise (form 1.xxxxx × 2ⁿ)
101.01 → 1.0101 × 2²
→ Mantissa (before padding): 1.0101
Step 3: Remove leading 1 and pad to 12 bits
Mantissa = 010100000000
(1.0101 → drop leading 1, pad with 0s to 12 bits)
Step 4: Write exponent in 4-bit two’s complement
Exponent = 2 → 0010
Final answer
Mantissa | Exponent |
---|---|
|
|
Convert −5.25 to floating-point binary
Step 1: Convert +5.25 to normalised form
+5.25 = 1.0101 × 2² → mantissa = 010100000000
Step 2: Convert mantissa to two’s complement (negative)
Take the 12-bit two’s complement of
010100000000
:Invert:
101011111111
Add 1:
101100000000
Mantissa for −5.25 =
101100000000
Step 3: Exponent is the same (+2)
Two’s complement of +2 in 4-bit binary =
0010
Final answer
Mantissa | Exponent |
---|---|
|
|
Summary table
Value | Binary | Normalised | Mantissa (12-bit) | Exponent (4-bit) |
---|---|---|---|---|
+5.25 |
|
|
|
|
−5.25 |
|
|
|
|
Floating-point binary to denary
How do you convert floating-point binary to denary?
For the following conversions we are assuming:
12-bit mantissa (in two’s complement)
4-bit exponent (in two’s complement)
Convert the following to denary (+)
Mantissa: 010100000000
Exponent: 0010
Step 1: Convert exponent from 4-bit two’s complement to denary
0010 (binary) = +2 (denary)
Step 2: Add back the implicit binary point in the mantissa
Mantissa is stored without the leading 1 (because it’s normalised)
So:
Stored mantissa: 010100000000
Restore: 1.01000000000
Step 3: Shift the binary point according to the exponent
Since exponent = +2 → shift binary point 2 places to the right:
1.01000000000 → 101.000000000
Step 4: Convert binary to denary
101 = 5
0.000000000 = 0
Final result: 5.0 (denary)
Convert the following to denary (-)
Mantissa: 101100000000
Exponent: 0010
Step 1: Exponent is again 0010 → +2
Step 2: Convert 12-bit two’s complement mantissa to denary:
101100000000
= negative value (MSB = 1)Take two’s complement to find magnitude:
Invert:
010011111111
Add 1:
010100000000
→ which is1.01000000000
Convert:
101.0
→ −5.0
Final result: −5.0 (denary)
Summary table
Mantissa | Exponent | Result (Denary) |
---|---|---|
|
| +5.0 |
|
| −5.0 |
Worked Example
Numbers are stored in two different computer systems by using floating-point representation.
System 1 uses:
10 bits for the mantissa
6 bits for the exponent
two’s complement form for both the mantissa and the exponent.
System 2 uses:
8 bits for the mantissa
8 bits for the exponent
two’s complement form for both the mantissa and the exponent.
Calculate the normalised floating-point representation of 113.75 and show how it would be represented in each of these two systems.
Show your working. [4]
Answer
conversion of 113.75 to binary seen
1110001.11
[1 mark]exponent for normalisation 7 converted to binary
111
OR evidence of binary [1 mark]point moved 7 places OR evidence of finding exponent = 7 [1 mark]
system 1 answer [1 mark]
system 2 answer showing correct version from system 1 [1 mark]
System 1
Mantissa | Exponent |
---|---|
|
|
System 2
Mantissa | Exponent |
---|---|
|
|
You've read 0 of your 5 free revision notes this week
Unlock more, it's free!
Did this page help you?