Skip to topic
    ← Back to course topics

    Integer numbers — AQA A-Level Computer Science

    In AQA A-Level Computer Science, integer representation covers unsigned binary, two's complement for signed values, and sign and magnitude formats across defined bit depths. Mastering these integer systems is essential for calculating numerical ranges, performing binary arithmetic, and identifying arithmetic overflow errors in the processor.

    Integer numbers explained

    An integer is a whole number with no fractional or decimal part.

    Read the full explanation

    It may be positive, negative or zero. In the AQA convention the natural numbers ℕ already include zero, so the integers extend ℕ by adding the negative whole numbers rather than by adding zero. In computing, integers are the basic numeric type used for counting, indexing and whole-number arithmetic. Recognising an integer means checking that a value has no fractional component: 7 and −12 are integers, while 3.5 and 1/2 are not. Integer values can be represented exactly within a fixed number of bits, but only across a finite range, so very large or very small whole numbers may overflow. Being familiar with the concept means being able to identify, classify and use integers correctly in both mathematical and programming contexts.

    Your focus

    1. Be familiar with the concept of an integer and

    Which command word is this?

    Show clear mathematical steps. In binary integer questions, this requires showing bit-level manipulations, column additions, and carry bits, followed by the final numeric string.

    Integer numbers exam tips

    Topic Overview

    Integer numbers form the bedrock of numerical data representation in computer systems, defining how whole numbers are encoded into discrete sequences of binary digits. The AQA A-Level specification requires students to understand unsigned binary for non-negative values as well as sign and magnitude and two's complement for handling positive and negative values across specified register widths.

    Beyond simple base conversion, this topic explores the operational consequences of integer formats within the Arithmetic Logic Unit (ALU). Mastering two's complement representation is critical because it simplifies processor design by allowing subtraction to be performed using standard addition circuitry, while also introducing specific boundary constraints such as arithmetic overflow.

    Key Concepts
    • →Unsigned binary encodes whole numbers greater than or equal to zero over n bits, spanning the range 0 to 2^n - 1.
    • →Two's complement assigns a negative weight (-2^(n-1)) to the most significant bit (MSB), providing an efficient representation for signed numbers across the range -2^(n-1) to 2^(n-1) - 1.
    • →Sign and magnitude reserves the MSB solely to denote sign (0 for positive, 1 for negative), which introduces dual representations of zero (+0 and -0) and requires separate, complex hardware for addition and subtraction.
    • →Arithmetic overflow occurs in signed binary arithmetic when an operation produces a result that falls outside the representable range of the target bit width, detectable when two operands of identical sign yield a result of the opposing sign.
    Marking Points
    • Identifies a value as an integer when it is a whole number with no fractional part.
    • Includes negative numbers and zero within the set of integers.
    • States that, since ℕ already includes zero, the integers extend ℕ by adding the negative whole numbers.
    • Distinguishes integers from decimals and fractions such as 3.5 or 1/2.
    • Recognises that a fixed number of bits can only store integers within a finite range.
    Examiner Tips
    • 💡Check whether the value has any fractional part before classifying it.
    • 💡Remember that the set of integers includes negative numbers and zero.
    • 💡When asked about the relationship to ℕ, note that ℕ already includes zero, so integers add the negatives.
    • 💡When asked about storage, mention that integer range depends on the number of bits.
    • 💡Always write out full binary byte patterns with leading zeros when a specific bit depth (such as 8-bit or 16-bit) is instructed in the question.
    • 💡Show clear column-by-column carry bits in binary addition questions; examiners award method marks for visible carry working even if a slip occurs in the final sum.
    Common Mistakes
    • Says integers extend the natural numbers by adding zero; in the AQA convention ℕ already includes zero, so the extension is the negative whole numbers.
    • Treats zero as neither positive nor negative and so excludes it; zero is an integer.
    • Assumes that a number like 4.0 is a non-integer; its value is a whole number, so it is an integer in value.
    • Believes integers are unlimited in computer storage; they are constrained by the number of bits used.
    • Assuming that sign and magnitude and two's complement produce the same bit patterns for negative integers. While positive integers share identical patterns in both formats, negative integers differ fundamentally because two's complement uses a weighted negative MSB.
    • Believing that an end carry bit automatically indicates an arithmetic overflow. In two's complement arithmetic, an end carry discarded from the MSB is normal in operations involving negative numbers and only indicates overflow if the sign of the result is mathematically contradictory.
    Revision Plan
    1. 1Day 1-2: Review positional values for binary and practice conversions between denary, unsigned binary, and hexadecimal.
    2. 2Day 3-4: Master the two's complement negation technique (invert bits and add 1, or locate the rightmost 1 and invert preceding bits) and compute ranges for various bit widths.
    3. 3Day 5-6: Practice signed binary addition and subtraction problems, explicitly annotating carries and identifying whether overflow occurs.
    4. 4Day 7: Compare sign and magnitude against two's complement, writing structured answers on why two's complement is standard in modern ALU architectures.
    Exam Question Types
    • 📋Direct Conversion Questions: Converting positive and negative denary integers to and from fixed-width two's complement binary or hexadecimal.
    • 📋Binary Arithmetic and Overflow: Performing addition on two signed binary numbers, displaying all carry rows, and explaining whether the result is mathematically valid.
    • 📋Comparative and Evaluative Questions: Explaining the architectural advantages of two's complement over sign and magnitude, referencing ALU complexity and the representation of zero.
    Command Word Expectations (AQA)
    Calculate / Convert

    Show clear mathematical steps. In binary integer questions, this requires showing bit-level manipulations, column additions, and carry bits, followed by the final numeric string.

    Explain

    Identify a specific technical characteristic and link it to its cause or consequence (for example, explaining that two's complement avoids duplicate zeros, which simplifies comparison logic in hardware).

    State

    Provide a concise numerical or factual answer without requiring extended written justification, such as quoting the minimum range limit of an n-bit register.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Confusing a standard end carry with an arithmetic overflow in signed two's complement addition.
    ❌ Weak Answer (Loses Marks):Overflow happened because there was a carry bit generated off the end of the byte.
    Example improved answer:An arithmetic overflow occurs when the result of adding two numbers of the same sign produces a result with the opposite sign, indicating the true value exceeds the range representable by the allocated bit width (-128 to +127 for an 8-bit signed integer). A carry out of the most significant bit alone does not necessarily signify an overflow in signed arithmetic.
    Examiner Tip: Always inspect the signs of the operands and the result: adding two positive integers must not produce a negative result, and adding two negative integers must not produce a positive result.
    Pitfall: Miscalculating the minimum representable value for an n-bit two's complement integer by assuming symmetrical positive and negative limits.
    ❌ Weak Answer (Loses Marks):The range of an 8-bit two's complement integer is -127 to +127.
    Example improved answer:The range of an 8-bit two's complement integer is -128 to +127, described generally as -2^(n-1) to 2^(n-1) - 1. Because zero is represented uniquely as 00000000, there is one additional negative value available.
    Examiner Tip: Remember that two's complement has an asymmetric range because zero uses one of the non-negative bit patterns, leaving 2^(n-1) negative values but only 2^(n-1) - 1 positive values.
    Step-by-Step Worked Solutions

    Question: Convert the denary integer -86 into an 8-bit two's complement binary representation. Then, perform binary addition of -86 and +42 in 8-bit two's complement, showing all carry bits, and state whether an overflow has occurred.

    1. 1.Step 1: Write the positive denary value (+86) as an 8-bit unsigned binary number. 86 = 64 + 16 + 4 + 2, giving 01010110.
    2. 2.Step 2: Apply the two's complement method to find -86 by inverting all bits (one's complement) and adding 1. Inverting 01010110 gives 10101001. Adding 1 gives 10101010.
    3. 3.Step 3: Convert +42 to an 8-bit binary number. 42 = 32 + 8 + 2, giving 00101010.
    4. 4.Step 4: Perform binary addition: 10101010 (-86) + 00101010 (+42). Adding column by column from right to left: 0+0=0; 1+1=0 (carry 1); 0+0+1=1; 1+1=0 (carry 1); 0+0+1=1; 1+1=0 (carry 1); 0+0+1=1; 1+0=1. The result is 11010100.
    5. 5.Step 5: Verify the result and check for overflow. 11010100 has a value of -128 + 64 + 16 + 4 = -44, which equals -86 + 42. Since we added a negative and a positive number, arithmetic overflow is mathematically impossible.
    Final Answer: -86 in 8-bit two's complement is 10101010. The sum of -86 and +42 is 11010100 (-44 denary). No overflow has occurred.

    Question: State the maximum and minimum denary integers that can be stored in a 12-bit register using: (a) unsigned binary representation, and (b) two's complement representation. Express the maximum unsigned value in hexadecimal.

    1. 1.Step 1: For an unsigned n-bit binary integer, the formula for the range is 0 to (2^n - 1). For n = 12, minimum value = 0 and maximum value = 2^12 - 1 = 4096 - 1 = 4095.
    2. 2.Step 2: Convert the maximum unsigned value (4095) to hexadecimal. 4095 in 12-bit binary is 1111 1111 1111. Grouping into nibbles gives F, F, F, which is 0xFFF.
    3. 3.Step 3: For a signed two's complement n-bit binary integer, the formula for the range is -2^(n-1) to (2^(n-1) - 1). For n = 12, n - 1 = 11.
    4. 4.Step 4: Calculate the two's complement boundaries: minimum value = -2^11 = -2048; maximum value = 2^11 - 1 = 2048 - 1 = +2047.
    Final Answer: (a) Unsigned: Minimum = 0, Maximum = 4095 (0xFFF in hexadecimal). (b) Two's complement: Minimum = -2048, Maximum = +2047.
    Active Recall Memory Test
    What is the general algebraic formula for the range of values representable by an n-bit two's complement integer?
    Key Fact: -2^(n-1) to 2^(n-1) - 1
    What are the two major architectural drawbacks of using sign and magnitude representation for integers in hardware?
    Key Fact: It produces two representations of zero (+0 and -0) and requires separate, more complex circuitry for subtraction rather than reusing addition units.
    How can an ALU identify an arithmetic overflow condition when adding two signed integers?
    Key Fact: When two operands with the same sign bit are added and produce a result with a different sign bit (or when the carry into the sign bit differs from the carry out).
    What is the 8-bit two's complement bit pattern for the denary number -1?
    Key Fact: 11111111
    Frequently Asked Questions
    What is the quickest shortcut to convert a positive binary number to negative two's complement?
    Start from the rightmost bit (least significant bit) and copy all bits unchanged up to and including the first '1'. After that first '1', invert all remaining bits to the left. For example, to negate 00101000, keep '1000' and invert the preceding '0010' to get 11011000.
    Why does two's complement have one more negative number than positive numbers?
    An n-bit binary system provides 2^n unique bit patterns. Zero is represented with an MSB of 0 (e.g., 00000000 in an 8-bit system), which consumes one of the 2^(n-1) patterns allocated to non-negative numbers, leaving positive values from 1 to 2^(n-1) - 1. Because negative values do not have to accommodate zero, all 2^(n-1) negative bit patterns can represent distinct values from -1 down to -2^(n-1).
    Can an overflow ever occur when adding a positive integer to a negative integer?
    No, an overflow cannot occur when adding operands of opposite signs. Adding a positive and a negative number produces a sum that is strictly between the two operand values, meaning the magnitude of the result is guaranteed to be smaller than the magnitude of at least one of the inputs and will always fit within the existing bit width.
    Why do computers use two's complement instead of sign and magnitude?
    Two's complement simplifies computer hardware by enabling the ALU to use the exact same adder circuits for both addition and subtraction, because subtracting B from A is identical to adding A and the two's complement of B. Additionally, it eliminates the redundant representation of zero (-0 and +0) present in sign and magnitude, preventing ambiguity in logic tests and comparisons.