Jump to content

Binary Division

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
ZipOnTrousers

ZipOnTrousers

    Learning Programmer

  • Validating
  • PipPipPip
  • 94 posts
Hi guys, I'm REALLY struggling to understand how to divide in binary. I'll read some examples and understand it but then seem to keep failing to apply it properly to new examples. What I'm trying to work out is -20/2, so i have:

____________
10)1111 0110

Could anyone work through this showing EVERY step so i can understand what I'm doing wrong?

Cheers, -Zip

#2
manux

manux

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 234 posts
it's really the same thing as a normal division, but you cant write 2s and 3s up to nines :D

So:

______________

10     | 1111 0110

       |-10

1      | 0111 0110

       | -10

11     | 0011 0110

       |  -10

111    | 0001 0110

       |   -1 0

1111   | 0000 0110

       |     -10

11110  | 0000 0110

       |      -10

111101 | 0000 0010

       |       -10

1111011| 0000 0000


Result 1111011, remainder 0
Back to kindergarden!
246/2 = 123 = b1111011

(note the bitshift following a division by 2)