Click to see the rest of the Data Representation section :
In the previous section we looked at how Binary Addition can be used to by a computer system to make powerful calculations. In this section, we will be looking at performing a logical shift, also known as a Bit Shift can be used to make multiplication in binary easier.
Moving binary numbers either left or right along the conversion table is known as a Bit Shift. Moving to the left multiplies by a power of 2, whereas right divides.
Whilst it may be possible to multiply binary numbers simply by adding them together, it is more efficient to apply a bit shift as it is a much quicker process. Remember though that this only works if you are attempting to multiply by a power of 2:
In the example above, the number 10 is shifted one place to the left to multiply by 2, or two places to the left to multiply by 4. Dividing in this case would require us to shift the same number of places to the right.
So what if we needed to multiply by a number that isn’t a power of 2? This can be achieved by combining a bit shift and binary addition.
In the example below, we are multiplying 10 by 3. To do this:
- shift to multiply by 2.
- add another 10 ( *1)
- add the shift and extra 10 together
Find this page helpful? Share the love on your social media mentioning @TeachAllAboutIT and we’ll enter you in our monthly draw to win a gift voucher for any product on the site!