Binary and data representation - EdexcelBinary shifts
All data in a computer is represented in binary, whether it is numbers, text, images or sound. The computer software processes the data according to its content.
binaryA number system that contains two symbols, 0 and 1. Also known as base 2. numbers are multiplied and divided through a process called shifting. There are two types of binary shift - arithmetic and logical. They work the same way for positive numberA number that is bigger than zero. but differently for negative numberA number less than zero..
Multiplying and dividing binary numbers using binary shifts
Logical shift left is used to multiply a positive number. To multiply a number, a binary shift moves all the digits in the binary number along to the left and fills the gaps after the shift with 0:
to multiply by two, all digits shift one place to the left
to multiply by four, all digits shift two places to the left
to multiply by eight, all digits shift three places to the left
and so on
Example: 00001100 (denaryThe number system most commonly used by people. It contains 10 unique digits 0 to 9. Also known as decimal or base 10. 12) × 2
128
64
32
16
8
4
2
1
0
0
0
0
1
1
0
0
128
0
64
0
32
0
16
0
8
1
4
1
2
0
1
0
Result: shifting one place to the left gives 00011000 (denary 24)
128
64
32
16
8
4
2
1
0
0
0
1
1
0
0
0
128
0
64
0
32
0
16
1
8
1
4
0
2
0
1
0
Example: 00010110 (denary 22) × 4
128
64
32
16
8
4
2
1
0
0
0
1
0
1
1
0
128
0
64
0
32
0
16
1
8
0
4
1
2
1
1
0
Result: shifting two places to the left gives 01011000 (denary 88)
128
64
32
16
8
4
2
1
0
1
0
1
1
0
0
0
128
0
64
1
32
0
16
1
8
1
4
0
2
0
1
0
Logical shift right
Logical shift right is used to divide a positive number. To divide a number, a binary shift moves all the digits in the binary number along to the right and fills the gaps after the shift with 0:
to divide by two, all digits shift one place to the right
to divide by four, all digits shift two places to the right
to divide by eight, all digits shift three places to the right
and so on
Example: 00100100 (denary 36) ÷ 2
128
64
32
16
8
4
2
1
0
0
1
0
0
1
0
0
128
0
64
0
32
1
16
0
8
0
4
1
2
0
1
0
Result: shifting one place to the right gives 00010010 (denary 18)
128
64
32
16
8
4
2
1
0
0
0
1
0
0
1
0
128
0
64
0
32
0
16
1
8
0
4
0
2
1
1
0
Example: 00001111 (denary 15) ÷ 2
128
64
32
16
8
4
2
1
0
0
0
0
1
1
1
1
128
0
64
0
32
0
16
0
8
1
4
1
2
1
1
1
Result: shifting two places to the right gives 00000111 (denary 7). Note - 15 ÷ 2 = 7.5. However, in this form of binary, there are no decimals, and so the decimal is discarded.
128
64
32
16
8
4
2
1
0
0
0
0
0
1
1
1
128
0
64
0
32
0
16
0
8
0
4
1
2
1
1
1
Example: 00110110 (denary 54) ÷ 4
128
64
32
16
8
4
2
1
0
0
1
1
0
1
1
0
128
0
64
0
32
1
16
1
8
0
4
1
2
1
1
0
Result: shifting two places to the right gives 00001101 (denary 13). Note – 54 ÷ 4 = 13.5. However, when the decimal is discarded, the answer is 13.’