Rss

  • youtube
  • google

How to take the ones complement of a binary number

1 Star2 Stars3 Stars4 Stars5 Stars

This is a simple tutorial on how to take the ones complement of a binary number. This has a few uses, such as toggling in a C program, but is most useful as the first step in transferring a binary number to its two’s complement. I will upload a video on that in the near future. Please make sure to watch the video in HD, because it is 1080 quality, and will be much more readable at that setting.

Step One:

Write out the number so that there is some space below or above it. This makes it easier to see that you haven’t made any mistakes.

Step Two:

Write the opposite of each bit (a 1 or 0 is a single bit) above or below the bit. (a one should have a zero, and a zero should have a one)

Step Three:

At this point you will have the binary ones complement of the number, and if you want to double check your work you can add the two numbers together, and you will come out with a binary result that is all ones, and is equal to the highest value that however many bits you are using can represent (4 bits max is 15, 8 bits is 255).

If you have any questions, leave them in a comment below. If there are any changes I should make to the video, let me know, and I will replace this video with an upgraded one.

I now accept donations through Bitcoins! If you don’t know what those are, you can get more information about them at bitcoin.org. My average donations are usually less than .001 BTC, but any amount helps me to make more tutorial videos, so any amount is gladly accepted.

1ADjWdgFPs3pni8PnLvSYeY3w16VqdL2tC

Like This Post? Share It


Warning: count(): Parameter must be an array or an object that implements Countable in /home/public/wp-includes/class-wp-comment-query.php on line 388

Leave a Reply