Units and data representation - OCRBinary shifts

All data is represented as binary digits, whether it is numbers, text, images or sound. Calculations are also done in binary.

Part ofComputer ScienceComputer systems

Binary shifts

numbers are multiplied and divided through a process called shifting.

Multiplication

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 - 1100 ( 12) × 2

1286432168421
1100
128
64
32
16
81
41
20
10

Result: shifting one place to the left gives 11000 (24 denary)

1286432168421
11000
128
64
32
161
81
40
20
10

Example - 10110 (denary 22) × 4

1286432168421
10110
128
64
32
161
80
41
21
10

Result: shifting two places to the left gives 1011000 (denary 88)

1286432168421
1011000
128
641
320
161
81
40
20
10

Division

To divide a number, a binary shift moves all the digits in the binary number along to the right:

  • 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 - 100100 (denary 36) ÷ 2

1286432168421
100100
128
64
321
160
80
41
20
10

Result: shifting one place to the right gives 10010 (denary 18)

1286432168421
10010
128
64
32
161
80
40
21
10

Example - 1111 (denary 15) ÷ 2

1286432168421
1111
128
64
32
16
81
41
21
11

Result: shifting two places to the right gives 111 (denary 7).

Note - 15 ÷ 2 = 7.5. However, in this form of binary, there are no decimals, and so the decimal is discarded.

1286432168421
111
128
64
32
16
8
41
21
11

Example - 110110 (denary 54) ÷ 4

1286432168421
110110
128
64
321
161
80
41
21
10

Result: shifting two places to the right gives 1101 (denary 13)

1286432168421
1101
128
64
32
16
81
41
20
11

Multiplying and dividing binary numbers using binary shifts