Pages: <Previous  24    25    26    27    28    29    30    31    32    33    34  Next >

7 Binary arithmetic

7.5 Dividing 2's complement integers

Just as multiplication can be turned into repeated additions, so division can be turned into repeated subtractions. And just as shifting a binary integer one place to the left equates to multiplying by two, so shifting a binary integer one place to the right equates to dividing by two.

Activity 27 (Exploratory)

How many places to the right do you think you would need to shift a binary integer to achieve division by eight?

Now read the discussion

Note that in integer arithmetic a fractional result is not possible. So if the divisor does not go exactly into the number to be divided then the result will have to be in the form of ‘it divides in such-and-such a number of times, with a remainder of such-and-such’.

Pages: <Previous  24    25    26    27    28    29    30    31    32    33    34  Next >