Two’s Complement

The Two’s Complement is one of those important things you learn in digital electronics. Simply put in a few steps. For a negative number you would
1. Take its absolute value.
2. Convert it into binary like you would normally do
3. Complement it
4. Add one.
So -5 would be 5. Which is 0101. Which becomes 1010 when you complement it. Which becomes 1011 when you add 1 to it.
For a positive number it’s just the usual.

But whats interesting about this whole thing is that it’s just like an odometer. Assuming it can count to hundred. Go forward, it’s 0 1 2 3 4 … Go back, it’s 0 99 98 97. It’s something a lot of teachers fail to teach. Now it makes sense why this notation is preferred for hardware applications.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s