In computer world, most numbers are handled in base 2. In fact, most computers since the 1950’s now use base two. The base two system is technically called binary digit or bit. The bit is a short form of binary digit( b for binary and the it is from the last two letters in digit). In the human world, we use mostly base 10 which is technically called decimal system. What is the difference between these two systems? Well, in computers or electronic systems, the only have two way life, either something is “ON” or “OFF” so there was the need to represent the circuits or transistors that make up those systems to obey only those two existence; ON or OFF. The binary system is made up of only two numbers; a 0 and 1. 0 represents “OFF” and 1 represents “ON” in computers and electronics. The decimal system is made of numbers from 0 to 9. It is easier to write decimal numbers and recognize them than binary numbers. Binary numbers turn to look longer than decimal numbers. The advantage of a binary number over decimal numbers is that, even though they look longer to us, they are faster to process and therefore increasing the speed of computers. I hope you can figure out where they are faster to process; they are made up of only two numbers, 0 or 1. As an illustration, if you know something about programming and you want to test user input based on a single digit entered, if you are using binary system, you are simply going to test for two numbers, 0 or 1. But if you are using the decimal system, you have to write test for ten digits and the system have to compare user input to all those ten digits and it will last longer than in binary mode. That’s just an illustration. OK, let’s go on, there are other number systems such as hexadecimal, which is also used in computing, but l’m going to stick to just base 10 and base 2 in this discussion. As a side note, 8 bits form a byte and that’s what computer memory is measured. From bytes, you go to megabytes, then gigabytes, then terabytes. Back to business, so we want to convert a number in base 10 to base 2 (binary). There are two ways l know how to solve this that does not need a lot of mathematical background. The easiest one and the one l use most often is what l’m going to talk about first. This is the procedure. Example, You are given the number 158 in base ten and asked to convert to binary. I’m going to tabulate the procedure below, you are going to do division using the base at each level and write the remainder after the division on the right at each level. The number of times the base is able to go into the number at each level is what becomes the new number to divide in the next stage, do this until you get zero left to divide. The number in base 2 will be the outputted remainder on the right from bottom up.

Destination base number to convert Remainder after each division
2 158 0
2 79 1
2 39 1
2 19 1
2 9 1
2 4 0
2 2 0
2 1 1
0

The binary digit or base 2 form of 158 then is 10011110

The other method which looks kind of trivial to me is below.

First, you’ll write down the powers of 2 from to the highest you can or to something greater than the number you are trying to convert.

Here are the powers of 2:  1, 2, 4, 8, 16, 32, 64, 128, 256 and so on.

For our example, we are converting 158 into binary. We look through our list above and try to locate the highest number in the list that can go into 158. The highest is 128. So when you locate 128, you see it can go into 158 only once so we write down 1. then subtract 128 from 158 and be left with 30.Traverse the list down to the beginning to from where you locate the first highest number, 128, and see if any number down the list can go into the number left. If a number is not able to go into it, you write zero to the right of the digits you already wrote down from previous divisions. If a number in the list is able to go into the number left, you will write 1 to the right of the digits and subtract that number from the list out of what you had and keep the new remainder for processing the rest of the list. To make things little clear, let me go through with our example.

So l write down 1 and after subtracting 128 from 158, l get 30 so l go down from 128 in my list to the left, l locate 64, it can not go into 30 so l write down zero to the right of 1, like this 10. Then l move from 64  to 32 in the list and it can not go into 30 so l write down another zer0 to the right of the digits l already had, that’s 100. I move down to 16 in my list and horay, it goes in 30 so l write 1 to the right of my digits, thats 1001, then subtract 16 from 30 to get 14. I move from 16 to 8 in my list and 8 can go into 14, so l write 1 to the right of my digits, that’s 10011. Then l subtract 8 from 14 to get 6. I move down the list from 8 and l find 4 which can go into 6 so l write down 1 to the right of my digits, that’s 100111, then subtract 4 from 6 to get 2. I move down the list from 4 and find 2, which can go into the two l was holding in hand so l write down 1 to the right of my digits, that’s 1001111 and subtract 2 from 2 to get 0. I move down the list from 2 and find 1 which can not go into zero so l write zero to the right of my digits, that’s 10011110 and the list is complete so l’m done. The binary form of 158 is then my digits 10011110. Which is the same as what we got in the previous procedure. Now, choose what you want and apply it to any other base below ten to convert from decimal to that base. it’s the same procedure. if you want to convert to a base 5 or 6 or 7 or 8 or 3, or 4, you simply replace that with the base two and follow the same procedure illustrated above. If you find any errors, please add it as a comment to be corrected. Thanks for reading this junk lol

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *