Sunday, September 30, 2007

Subtraction in Binary

What do you use to subtract two binary numbers?
two's compliment?
Why to have so complicated approach ( of course on Paper )
Just use our basic decimal system approach and subtract the number normally.
For e.g.,
binary decimal
100 4
011 3

subtract 4-3 = 1
Just think that 4 is hundred in binary and 3 is eleven ( as it looks like visually ).
Now subtract 11 from 100 , you will get 89. Now replace 8 by 0 and 9 by 1
you will get 1 as the answer in binary.

When you subtract two binary numbers as decimal numbers, you have four possible numbers 0,1 , 8 and 9. Now since the answer should be in binary, 8 is even so replace by 0 ( as 8 mod 2 = 0) and 9 is odd so replace by 1 ( as 9 mod 2 = 1 ).

See how easy it goes !

No comments: