Hi stefan >> Because your source has a typo?
Yes this is what I thought. or that people do not understand it :) >>> Now doing 5 - 15 does not (or I miss something ilke always subtracting the >>> smaller one and taking the two complement of the smaller…) >>> so does anybody has the answer on how to perform 5 - 15 ? > > http://en.wikipedia.org/wiki/Two%27s_complement#Subtraction I already read it in the past but may be I'm blind normally a -b = a + b'two complement So they say it but do not really show it example: 15 − 35 = −20: they do the negation and I want to see how the two complement actually works for real on negative number results. 11100 0000 (borrow) 0000 1111 (15) − 0010 0011 (35) =========== 1110 1100 (−20) ok but this example does not show use of two' complement. so we have 15 0000 1111 (15) and 0010 0011 (35) 1101 1100 (35 bitInvert) 1101 1101 (35 bitInvert+ 1) =35 two complement 0011111 (carry) 0000 1111 (15) + 1101 1101 35two complement ----------------- 1111111101100 ok it works. I did a mistake probably yesterday evening when I was playing with another example. So thanks redoing another example removed my bug. > > Regards > Stefan > > > > > -- > Stefan Marr > Software Languages Lab > Vrije Universiteit Brussel > Pleinlaan 2 / B-1050 Brussels / Belgium > http://soft.vub.ac.be/~smarr > Phone: +32 2 629 2974 > Fax: +32 2 629 3525 > >
