+5    0101
+ -5    1010
------------
  -0    1111


can someone tell me why -5 is 1010, I dont understand, and where can I read more about this.
Posted on 2005-03-19 03:31:08 by Rammstein
You'll find information in the first chapter of the Art Of Assembly Language by Randall Hyde :

http://webster.cs.ucr.edu/AoA/Windows/HTML/DataRepresentationa5.html#999509
Posted on 2005-03-19 06:07:08 by Dr. Manhattan
Is only a representation, we need to be consistent whit our representations.. or coherent ;).
Posted on 2005-03-19 08:57:30 by rea
If you check the 0 and 1s are switch. -5 instead of 0101=1010 the bits are inverted, see the 01 from the first one and the other one. Hope it helps.
01 the contrary is 10 I guess.
1                      -1
Posted on 2005-03-19 09:23:53 by Xor Stance
Rammstein,

can someone tell me why -5 is 1010, I dont understand


To obtain the ones complement of any number, simply invert the bits.? Inverting 5=0101, one obtains -5=1010.?

and where can I read more about this


Just about any book on logic or computer science will give a brief on ones complement arithmetic.? Ratch
Posted on 2005-03-19 10:44:37 by Ratch
By the way, 1's complement and 2'  complement is defined to any base but I not remember exactly how is :S...
Posted on 2005-03-19 12:03:24 by rea
:/

CPUs use sign-module-2 instead of sign-module-1 (which is presented here).

in sign module 2 we have:

  +5  0101
  -5    1011
----------------
  0    0000

zero (without any stupid negations). that's how CPU work, so you should focus on SM2, not SM1.

/
Posted on 2005-03-19 15:42:18 by ti_mo_n
ti_mo_n,

CPUs use sign-module-2 instead of sign-module-1 (which is presented here).


No such thing as sign-module whatever.? Do you mean signed-magnitude representation?? In any case, the INTEL CPU uses twos complement arithmetic.? Not all CPUs use twos complement arithmetic, however.? The original poster asked a question about ones complement arithmetic.? Ratch
Posted on 2005-03-19 19:50:24 by Ratch

By the way, 1's complement and 2'? complement is defined to any base but I not remember exactly how is :S...

No, the pair, 1's complement and 2's complement, are associated only with binary.

For any radix (also known as number base), there is a radix complement and a (radix - 1) complement.

So for decimal numbers, you have 10's complement and 9's complement.

And 2's complement can be used with trinary (base 3) numbers, although it's not the same as the binary 2's complement. Binary two's complement of 10 is 10, trinary two's complement of 10 is 12.
Posted on 2005-03-19 21:44:44 by tenkey
No such thing as sign-module whatever.

Yeah. Now i had the time to thoroughly check this out. the name sing-module- is a short for "'s complement, expressed as 'sign' digits, followed by 'module' digits. 

In any case, the INTEL CPU uses twos complement arithmetic.? Not all CPUs use twos complement arithmetic, however.

I don't count other CPUs, since there's a 99% chance, that i'll never use them :)

The original poster asked a question about ones complement arithmetic.

I thought that he wanted to learn x86 ASM arithmetic and that he was doing it the long way (through 1's compl.) so i proposed (assuming, that he may not know that) that he can switch to 2's complement, which is (imho) easier and more practical (in x86-asm sense) to learn.

sorry for the misunderstanding.
Posted on 2005-03-19 22:53:19 by ti_mo_n