Information Representation
Number bases, negative numbers, characters, images and sound — the AS-level treatment.
//Two's complement, and why it is clever
To make a number negative: invert every bit, then add 1. The leftmost bit becomes the sign bit — 1 means negative. The beauty is that subtraction becomes addition, so the processor needs only one circuit.
5 = 0000 0101
invert 1111 1010
add 1 1111 1011 = -5
8 - 5 is done as 8 + (-5):
0000 1000
+ 1111 1011
------------
1 0000 0011 carry off the end is discarded
answer 0000 0011 = 3//Range of an 8-bit two's complement number
One bit is the sign, so the range is −128 to +127. Note it is not symmetrical — there is one more negative value than positive, because zero takes a positive slot.
//BCD, and where it is used
Each denary digit is stored in its own 4 bits, so 59 is 0101 1001. It wastes space and is awkward for arithmetic, but converting to a display is trivial — which is why it is used in digital clocks, calculators and money systems where exact decimal values matter.
//Bitmap vs vector
Bitmap stores every pixel, so it handles photographs but becomes blocky when enlarged and the file grows with resolution. Vector stores shapes as instructions, so it scales to any size with no loss and stays small — but it cannot represent a photograph.
KEY TERMS
CHECK YOURSELF
1.In 8-bit two's complement, what is −5?
2.What is the range of an 8-bit two's complement number?
3.Which image type stays sharp at any size?