3.3.1 - Number bases and binary data
Learn how decimal, binary and hexadecimal write numbers, why computers use bits, and why the meaning of a bit pattern depends on how it is read.
Decimal, binary and hexadecimal
A number base tells us how many different digits a number system uses and how much each position is worth.
Number base
The number of distinct digits, including zero, used in a positional number system.
Decimal is base 10. Its digits are 0–9; moving one place left multiplies the place value by 10. In 24, the 2 represents two tens and the 4 represents four ones. The value is .
Binary is base 2. It uses only 0 and 1. Moving left multiplies the place value by 2, giving ones, twos, fours, eights and so on. Binary 101 has one four, no twos and one one, so its decimal value is 5. Writing 101 in decimal would mean one hundred and one: the digits alone do not tell us the base.
Hexadecimal is base 16. It needs sixteen digits: 0–9 followed by A, B, C, D, E and F for the values 10, 11, 12, 13, 14 and 15. Its first two places are ones and sixteens. Hexadecimal 1A means one sixteen plus ten ones, so it represents decimal 26. A hexadecimal digit such as F is a number digit, not a variable name.
We will label the base whenever a pattern could be ambiguous. A base changes the way a value is written; it does not change the quantity represented.
Bit patterns and interpretation
A computer stores and processes information using patterns of binary digits, called bits.
Electronic circuits can reliably distinguish two states, such as a low and a high voltage. We represent these states as 0 and 1. Combining many bits gives enough patterns to represent large amounts of information. Instructions that tell the processor what to do are stored in binary too; binary is not limited to numerical data.
The bits do not contain their own meaning. Consider the eight-bit pattern 01000001. If read as an unsigned whole number it means 65. If read using an ASCII character table it means the letter A. If a file defines each bit as a black or white pixel, it could instead describe eight pixels. Other agreed formats let bit patterns describe measured sound samples or machine instructions.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account