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
- 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
- 1Day 1-2: Review positional values for binary and practice conversions between denary, unsigned binary, and hexadecimal.
- 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.
- 3Day 5-6: Practice signed binary addition and subtraction problems, explicitly annotating carries and identifying whether overflow occurs.
- 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)
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.
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).
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)
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.Step 1: Write the positive denary value (+86) as an 8-bit unsigned binary number. 86 = 64 + 16 + 4 + 2, giving 01010110.
- 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.Step 3: Convert +42 to an 8-bit binary number. 42 = 32 + 8 + 2, giving 00101010.
- 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.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.
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.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.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.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.Step 4: Calculate the two's complement boundaries: minimum value = -2^11 = -2048; maximum value = 2^11 - 1 = 2048 - 1 = +2047.