BINARY SHIFT Multiplication and Division Binary Shift As you know a computer can only add, not subtract. For the same token it can still only add, not multiply or divide. Multiplication is usually achieved by repeatedly adding, and division is usually achieved by repeatedly 'subtracting' (or as we know, adding through the use of two's complement). Binary Shift There are occasions when you can 'cheat' in multiplication/division, but only when the number you are multiplying/dividing by is a number on the binary scale eg. 2, 4, 8 etc. We'll stick with whole numbers Binary Shift Firstly, you need to remember the binary scale 25 24 23 22 21 20 32 16 8 4 2 1 Now you need to pay close attention to two things: the number in each column The exponent above the 2, that corresponds to each number Eg. The number 8 has the exponent 3 Binary Shift: Left Shift Now lets use a multiplication example: 5 x8 We can start by determining the exponent that corresponds to 8, and re-write the question 5 x 23 Binary Shift: Left Shift Remember the problem is: 5 x 23 Now use your columns to write down 5 in binary Below you original value of 5, move all the bits 3 places to the left, and pad the holes with 0’s 1 25 24 23 22 21 20 32 16 8 4 2 1 0 1 1 0 1 0 0 0 Binary Shift: Left Shift 5 x 23 (or if you prefer 5 x 8) is equal to 40, this can be easily achieved by shifting the whole number 3 places up the binary scale. Try the following two multiplications: 7 x4 3 x 16 Binary Shift: Right Shift Now lets look at a division example: 35 / 16 We can start by determining the exponent that corresponds to 16, and re-write the question 35 / 24 Binary Shift: Right Shift Remember the problem is: 35 / 24 Now use your columns to write down 35 in binary Below you original value of 35, move all the bits 4 places to the right 25 24 23 22 21 20 . 2-1 2-2 2-3 2-4 32 16 8 4 2 1 . .5 .25 .125 .0625 1 0 0 0 1 1 . . 1 0 . 0 0 1 1 Binary Shift: Right Shift 35 x 24 (or if you prefer 35 / 16) is equal to 2.1875, this can be easily achieved by shifting the whole number 4 places down the binary scale. Try the following two divisions: 17 /4 131 / 32 Binary Shift At this point you should know that: Multiplying is a Left Shift (because you are making the number bigger) Dividing is a Right Shift (because you are making the number smaller) If one of the numbers in the multiplication/division is a number on the binary scale, check the exponent of that number and move the other number up/down the scale by the number of places in the exponent