At 10:06 7/03/00 +0200, you wrote: >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!!! > Somebody has already pointed out that you need to invert the number then add 1. Here's a short cut you may find useful. Starting at the least significant bit, copy any trailing 0's and the first 1 you encounter. Now invert everything to the left. eg1. 101000011 00001001 There are no trailing 0's so copy the lsb (1) and invert all to the left 010111100 11110111 eg2. 11001111 00010000 number 00110000 11110000 2's comp cheers. Bob Jenner Trading as RAJE Consulting 3 Cahill Cr Nakara NT 0810 Tel 08 89 455 796 Fax 08 89 275147 http://www.coolspot.com.au