Re: A82: 2's compliment
[Prev][Next][Index][Thread]
Re: A82: 2's compliment
>This is more of a question for Dines, but I sent it to the list in case anyone
>else could answer it.
>Well, I obviously don't understand 2's compliment, because I couldn't get it
>to work with Dines' routines.
>So............could someone explain how it works?
2's compliment works like this:
The negative of a number (say, 1) is equal to its logical NOT plus 1.
So, 1 = %0000 0001
NOT(1) = %1111 1110
+1 = %1111 1111
And 0xff in 2's compliment 8 bit numerics is the number negative one.
Hope this helps,
Eric
+----------------+------------------+
| Eric O'Connell | Mac Programmer |
+----------------+ Guitarist |
| titan@gate.net | Math Hobbiest |
| drdistort(irc) | Insensitive Male |
+----------------+------------------+
| web: http://www.gate.net/~titan |
+-----------------------------------+
References: