Originally posted by -X-
lol MS calculator gives "111111111111111111111111....." as the answer.
MS Calculator uses the twos complement system and 1111111111... is the twos complement representation of -1 in normal binary.
Everyone seems to be confusing normal binary numbers with twos complement binary, they are different systems!
1. Lets do 1000-1001 in normal binary:
This is the decimal subtraction 8 - 9, which you would not attempt directly in decimal, rather you'd do what fatmuscle said and do 9-8 then make the answer a negative. The same applies in binary, so the answer in binary is -1.
2. Now in twos complement:
In twos complement the range of numbers wraps around to form a circle. So with 8bits the range is -128 to 127 (10000000 to 01111111), however if you add 1 to 127 you end up at -128 (this is an example of overflow). This wrap around means that you can do subtractions like 1000-1001 with twos complement.
If its a 4bit twos complement system then using normal subtraction you get:
1000 -
1001
--------
1111
(Does this need more explanation!)
Sam