1.1 Number systems
Binary system
Base 2 number system based on the number 2. Only the values 0 and 1 can
be used to represent any numbers.
Converting from binary to denary:
Take the binary number (e.g. 11101110)
Write it out under a table that goes from right to left starting with
1,2,4,8,16 e.t.c and lasts for the whole number
Take all the values that have 1 underneath and add them together
E.g. Convert 11101110 to a denary number:
128 64 32 16 8 4 2 1
1 1 1 0 1 1 1 0
The equivalent denary number is 128 + 63 + 32 + 8 + 4 + 2 = 238
Converting from denary to binary:
- Start with the denary number
- Divide it by 2
- Write the result of the division inducing the remainder (either 0 or 1)
- Repeat until the answer is zero
- Write the remainders in reverse order
Hexadecimal system
The hexadecimal number system is closely related to the binary system. It
is a base 16 system and needs 16 different digits to represent each value.
The numbers 0-9 and the letters A-F are used to represent each digit.
A = 10 (in denary)
B = 11
C = 12
D = 13
E = 14
F = 15
, Binary places to hexadecimal values:
0000 = 0
0001 = 1
0010 = 2
0100 = 4
1000 = 8
To make more numbers you can mix them together:
0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 =7
1000 = 8
1001 = 9
1010 = A (10)
1011 = B (11)
1100 = C (12)
1101 = D (13)
1110 = E (14)
1111 = F (15)
To convert binary to hexadecimal:
- Break it into groups of 4 bits
- Convert each group to a hexadecimal
- Put it together
Example:
Convert 111010010110101 to a hexadecimal:
0111 0100 1011 0101
Add 0 to the first group
Hexadecimal: 74B5