Without compliments, by converting to decimal 1010 is 10 decimal - 0011 is 3 decimal ------ = 0111 is 7 decimal
This is unrealistic if given in the context of a computer doing the math. On x86 systems (and possibly others) the following assembly language instruction represents 10-3: SUB AL,3 ;where the AL register stores the value 10 What is really happening at the bit level is that the immediate (constant) value 3 is negated (by two's compliment), so: 00000011 (3) becomes 11111101 (-3) and is then added to the value in AL (in this example). So, 10-3 becomes 10+(-3), or: 00001010 + 11111101 ----------- = 100000111 ;the most significant (left-most) bit is "overflow", and is lost. In these examples, I've represented 8 bit values, rather than the 4 bits in your problem, but the method still holds true. As a further note, the SUB operation works for both signed and unsigned arithmetic. In this example, it is entirely up to the programmer to determine whether 11111101 represents -3 decimal or +253 decimal! This is accomplished by interpreting the Sign and Carry Flag status in the x86 flags register. In the above example, OF (the Overflow Flag) is set, and CF (the Carry Flag) is clear (but I digress).
Hope this helps. -- Philip M. D'Amato firstname.lastname@example.org "Any opinions expressed are not necessarily my own."
Roger Simms <email@example.com> wrote in article <firstname.lastname@example.org>... > Can some one help me with this simple problem that's driving me mad. > > 1010 > -0011 > ---- > 0111 > > Not using compliments just by borrowing and paying back I just cannot > see where you are meant to be borrowing from and where you are paying > back to > > > If any one can help i would be gratefull. > > > +===============================================================+ > | I'm as old as my tongue and a little bit older than my teeth | > | And I hope to keep both | > | ************************** | > |Roger Simms *Definition of Maturity * | > |Sutton *When you start worrying * | > |England *about Insurance * | > | ************************** | > +===============================================================+ >