[prev] 53 [next]

Signed integers (cont)

Ones complement: Easy to form -X from X ... NEG all bits

A problem (using 8-bit ints) ...

  • what do these numbers represent?  00000000,  11111111
Two zeroes ... one positive, one negative

At least  x + -x is equal to one of the zeroes with simple addition

  00000011  3     00101010  42      01111111
+ 11111100 -3   + 11010101 -42    + 10000000
  --------        --------          --------
  11111111 -0     11111111  -0      11111111 -0