A simple way to get the two's complement is to get the one's complement (invert the bits), then add one. The old PDP-8 called this instruction CIA for complement and increment accumulator. Another interesting two's complement idea I saw written years and years ago is to consider the "weighting" of the bits the same as for a pure binary number, but reverse the sign of the MSB. So, for example, 01101110 = 2+4+8+32+64=110 decimal 10010001 is 1's complement (inverting bits) 10010010 is 2's complement (adding 1 to 1's complement) Looking at weighting, we get 10010010 = 2+16-128= -110 decimal (note the MSB has a weight of -128 instead of +128, as it would in pure binary). Harold On Tue, 7 Mar 2000 10:06:10 +0200 Werner Soekoe writes: > Hi > > I'm looking for the way to calculate what the Two's > Complement of a value will be. Can anyone help me? > For instance: > > 8-bit value: > 01101110 > 10010001 (Inverted) > > But this is not two's complement yet!? What Next? > > Can somebody maybe also solve this one: > 16-Bit value: > 01011100 11110110 > 10100011 00001001 (Inverted) > > Thanks!!! > > Werner Soekoe > IS Manager > Free State Legislature > wsoekoe@global.co.za > Tel. +27 (51) 407 1109 > Fax. +27 (51) 407 1137 > Cell. +27 82 376 8383 FCC Rules Online at http://hallikainen.com/FccRules Lighting control for theatre and television at http://www.dovesystems.com ________________________________________________________________ YOU'RE PAYING TOO MUCH FOR THE INTERNET! Juno now offers FREE Internet Access! Try it today - there's no risk! For your FREE software, visit: http://dl.www.juno.com/get/tagj.