How to Convert Two's Complement and Floating-Point Binary Numbers in Cambridge A-Level Computer Science

How to Convert Two's Complement and Floating-Point Binary Numbers in Cambridge A-Level Computer Science
How to Convert Two's Complement and Floating-Point Binary Numbers in Cambridge A-Level Computer Science

Last Updated: October 2026 | By EdFlik Education Team

For high school students completing the Cambridge International AS & A Level Computer Science (9618) specification, data representation—specifically integer representation via Two's Complement and real number representation via Normalized Floating-Point Binary—represents a core examinable pillar. Featured heavily across Paper 1 (Theory Fundamentals) and Paper 3 (Advanced Theory), data representation questions routinely carry high-tariff calculation and conversion marks.

Every exam session, capable computer science students lose valuable marks not because they misunderstand programming logic, but due to procedural errors: miscalculating two's complement sign bits, failing to normalize mantissas correctly, or confusing exponent bias.

In this comprehensive, exam-focused masterclass guide, our expert Cambridge A-Level computer science educators break down the mechanics of signed integers, floating-point architecture, normalization rules, step-by-step conversion workflows, and common examiner traps.

Part 1: Two's Complement Signed Integers

Computers need a standardized way to represent both positive and negative integers using binary bits ($0$ and $1$). While Sign-and-Magnitude and One's Complement exist, Two's Complement is the universal industry standard because it eliminates the mathematical anomaly of "negative zero" and allows standard binary addition circuits to handle subtraction automatically.

                      TWO'S COMPLEMENT BIT SIGNIFICANCE
                                     |
        +----------------------------+----------------------------+
        |                                                         |
THE MOST SIGNIFICANT BIT (MSB)                            THE REMAINING BITS
• The leftmost bit acts as the **sign bit**.              • Represent positive positional values 
• If MSB = $0$, the number is **positive**.                 customarily, but the MSB carries a 
• If MSB = $1$, the number is **negative** (-2^(n-1)).       **negative** positional weight.

1. Converting a Negative Decimal Number to Two's Complement Binary

To convert a negative decimal number (e.g., $-25$) into an 8-bit Two's Complement binary number, follow this standard 3-step protocol:

          DECIMAL TO TWO'S COMPLEMENT WORKFLOW
                            |
  Step 1: Convert Positive  ---> Convert absolute value ($+25$) into standard 8-bit binary ($00011001$)
  Step 2: Invert the Bits   ---> Flip every bit ($0 \rightarrow 1$, $1 \rightarrow 0$) to form One's Complement ($11100110$)
  Step 3: Add Binary $1$    ---> Add $1$ to the LSB to get Two's Complement ($11100111$)

Worked Example: Convert $-25$ to an 8-bit Two's Complement Binary Number

  1. Positive 25 in 8-bit binary:$$128 \quad 64 \quad 32 \quad 16 \quad 8 \quad 4 \quad 2 \quad 1$$$$0 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0 \quad 0 \quad 1 \quad (25)$$
  2. Invert the bits (One's Complement):$$1 \quad 1 \quad 1 \quad 0 \quad 0 \quad 1 \quad 1 \quad 0$$
  3. Add binary $1$:$$11100110 + 1_2 = 11100111_2$$Thus, $-25$ in 8-bit Two's Complement is $11100111$.

2. Converting a Negative Two's Complement Binary Number to Decimal

To convert a negative Two's Complement binary number back to decimal, you can use either the Inversion Method or the Positional Weight Method.

The Positional Weight Method:

In an 8-bit Two's Complement byte, the MSB has a weight of $-128$ instead of $+128$:

$$-128 \quad 64 \quad 32 \quad 16 \quad 8 \quad 4 \quad 2 \quad 1$$

For $11100111_2$:

$$\text{Value} = 1(-128) + 1(64) + 1(32) + 0(16) + 0(8) + 1(4) + 1(2) + 1(1)$$$$\text{Value} = -128 + 64 + 32 + 0 + 0 + 4 + 2 + 1 = -25$$

Part 2: Normalized Floating-Point Binary Representation

To represent real numbers (fractions and very large/small numbers) in binary, computers use Floating-Point Representation, split into two primary components: Mantissa and Exponent.

                   FLOATING-POINT BYTE ARCHITECTURE
                                   |
        +--------------------------+--------------------------+
        |                                                     |
THE MANTISSA                                        THE EXPONENT
• Stores the significant digits (fractional part)   • Stores the power of 2 scaling factor.
• Contains the **sign bit** (first bit).            • Determines the range of the number.

1. Normalization Rules (Cambridge 9618 Standard)

To ensure every real number has a unique, unambiguous binary representation, Cambridge mandates that floating-point numbers must be stored in Normalized Form:

  • Positive Normalized Mantissa: Must start with $0.1$ (e.g., $0.101101_2$). The bit immediately after the binary point must be a $1$.
  • Negative Normalized Mantissa: Must start with $1.0$ (e.g., $1.010011_2$). The bit immediately after the binary point must be a $0$.
  • Why? A mantissa starting with $0.0$ or $1.1$ is unnormalized and results in lost precision or redundant leading bits.

Part 3: Step-by-Step Floating-Point Conversion Workflow

Converting a Decimal Real Number to Floating-Point Binary

Question: Represent $+5.75$ in a floating-point format using a 8-bit mantissa (including sign bit) followed by a 4-bit exponent (in Two's Complement).
          DECIMAL TO FLOATING-POINT WORKFLOW
                            |
  Step 1: Convert to Binary ---> Convert integer and fractional parts ($5.75_{10} = 101.11_2$)
  Step 2: Normalize Binary   ---> Shift binary point so number is between $0.5$ and $1$ ($0.10111 \times 2^3$)
  Step 3: Extract Mantissa   ---> Format 8-bit mantissa starting with $0.1$ ($01011100$)
  Step 4: Extract Exponent   ---> Convert exponent ($3$) to 4-bit Two's Complement ($0011$)

Step-by-Step Execution:

  1. Convert $+5.75$ to binary:
    • Integer part ($5$): $101_2$
    • Fractional part ($0.75$): $0.5 + 0.25 = 0.11_2$
    • Combined: $101.11_2$
  2. Normalize the binary number: Shift the binary point 3 places to the left:$$101.11_2 = 0.10111_2 \times 2^3$$
    • Mantissa unpadded: $0.10111$
    • Exponent: $+3$ ($0011_2$ in 4-bit Two's Complement)
  3. Format the 8-bit Mantissa: Pad with trailing zeros to fill 8 bits: $01011100$
  4. Format the 4-bit Exponent:$+3$ in 4-bit Two's Complement: $0011$
    • Final Floating-Point Representation: 01011100 0011

Part 4: Top 4 Traps That Cost Students Marks in 9618 Computer Science

  1. Writing Unnormalized Mantissas: Writing a positive mantissa that starts with $0.0...$ (e.g., $0.01101_2$). Remember: Positive normalized mantissas must start with $0.1$, and negative normalized mantissas must start with $1.0$.
  2. Two's Complement Exponent Overflow: Forgetting that the exponent is also stored in Two's Complement. If an exponent is negative (e.g., $-2$), it must be converted into Two's Complement binary (e.g., $1110_2$ in 4 bits).
  3. Confusing Mantissa Bit Lengths: Miscounting the total bit length of the mantissa. If an 8-bit mantissa is requested, the sign bit counts as part of those 8 bits (e.g., $1$ sign bit $+ 7$ magnitude bits).
  4. Incorrect Binary Fraction Place Values: Miscalculating fractional binary place values to the right of the binary point ($2^{-1} = 0.5$, $2^{-2} = 0.25$, $2^{-3} = 0.125$, $2^{-4} = 0.0625$).

Preparing for Cambridge International AS & A Level Computer Science (9618) and aiming for an $A^$ grade? EdFlik connects international school students globally with expert, 1-to-1 online A-Level computer science tutors, helping you master data representation, assembly language, networking, and past-paper mark scheme techniques. *Book a Free Demo Class Today!

Frequently Asked Questions (FAQs)

Q1: Why do we use Two's Complement instead of Sign-and-Magnitude?

Ans: Sign-and-Magnitude has two representations for zero ($+0$ and $-0$) and complicates hardware addition/subtraction circuits. Two's Complement provides a single unique representation for zero and allows negative numbers to be subtracted using standard binary addition.

Q2: How do I know when a floating-point number is normalized?

Ans: A binary floating-point number is normalized when the first two bits immediately following the sign bit are different ($0$ and $1$ for positive numbers, or $1$ and $0$ for negative numbers). This ensures maximum precision and avoids wasted storage bits.

Q3: What happens when an exponent exceeds its allocated bit capacity?

Ans: When an exponent exceeds its bit limit (e.g., trying to store an exponent of $+8$ in a 4-bit Two's Complement field that maxes out at $+7$), an exponent overflow occurs, resulting in a fatal runtime error or severe calculation inaccuracy.

Q4: How does EdFlik support Cambridge A-Level Computer Science students?

Ans: EdFlik connects international school students worldwide with vetted, expert 1-to-1 online tutors specializing in CAIE A-Level Computer Science (9618). Our personalized coaching covers theory fundamentals, advanced algorithms, programming, and rigorous past-paper drilling.

Computer Science Tutor UAE 2026 — IGCSE, IB CS, A-Level and AP CSA Guide
Find the right Computer Science tutor in UAE 2026. IGCSE 0478, IB CS IA, A-Level 9618, AP CSA Java — why programming-competent tutors matter. EdFlik from AED 65.
IGCSE Computer Science Past Papers 0478 UAE 2026 — Pseudocode & Technique Guide
Complete guide to Cambridge IGCSE Computer Science 0478 past papers for UAE students 2026. Where to download, Cambridge pseudocode format, trace tables, Paper 2 technique. Free trial EdFlik.
IB Computer Science Tutor UAE 2026 — HL & SL Programming & IA Specialists
Expert IB Computer Science tutoring in UAE. HL and SL algorithms, data structures, IA Dossier development. Live 1:1 from AED 70. Free trial with EdFlik.
IGCSE Computer Science 0478 Paper 2 Pseudocode Guide
Unlock the exact logical patterns, array manipulation structures, and trace table tracking methods to master Paper 2 of IGCSE Computer Science.