You need to find out the capital of Argentina. What do you do? You look it up on the internet. You need to set a reminder for when your next piece of homework is due. What do you do? You resort to using an electronic device to avoid the troubles of remembering something. But have you ever wondered how a computer actually performs what we want it to do? It is through something called the binary numerical system. Binary uses the numbers 0 and 1 to process information given, and by utilizing that specific series of numbers, it performs the desired function.
Binary originates from the 17th century, and has been an integral part of computers since the start. However, the binary sequence is not something that could be deciphered by us humans. The programs written go through an interpreter which converts the code to binary for only the computers to understand. Despite that, we have acquired the basic knowledge of how to convert binary to decimal numbers and vice versa. Today, we will be learning how to do just that!
To understand the basics of Binary let’s dive into the number system that we use on a daily basis: decimal. This includes the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and uses 10 as its base (the exponents of 10 underneath the lines).
Binary, however, employs 2 as the base and only goes up to 128. This framework is used for every data value stored.
The steps to convert from binary to decimal are as the following (use the picture below):
Start from the left side
In the first spot, determine if the number you are trying to find (which is 170 in the picture) is greater than or equal to 128.
If it is, place a 1.
If not, place a 0.
3. Then move down to the next spot and see if the sum of all the values with a 1 previously and the current spot (128 + 64) is less than or equal to the number you are trying to find.
If it is, add a 1 in that spot
If not, add a 0 in that spot
4. Then move down to the next spot and see if the sum of all the values with a 1 previously and the current spot (128 + 32) is less than or equal to the number you are trying to find.
If it is, add a 1 in that spot
If not, add a 0 in that spot
5. Then move down to the next spot and see if the sum of all the values with a 1 previously and the current spot (128 + 32 + 16) is less than or equal to the number you are trying to find
If it is, add a 1 in that spot
If not, add a 0 in that spot
6. Repeat the process all the way down to the last (eighth position)
7. There! You have your binary number
* Important note: The number you are trying to find has to be 255 or less
Now that we have learnt how to convert decimal numbers to binary, let’s learn how to do just the opposite. This is a pretty simple task compared to the previous. You just go through and add up all the values under the 1s.
As seen above: 10101010 = 128 + 32 + 8 + 2 = 170
Binary to Decimal Worksheet: https://docs.google.com/drawings/d/1LPEoPIma2JYo8tXurhfNO9IMhbiAx-wX8_DCS6a2ywU/edit?usp=sharing
Thanks for joining me on the path to success in the coding world!
Written by: Sravya Kota
“Binary Number System.” Binary Number System, 2019, www.mathsisfun.com/binary-number-system.html.
“What Is Binary and Why Do Computers Use It?” What Is Binary and Why Do Computers Use It?, 2018, www.howtogeek.com/367621/what-is-binary-and-why-do-computers-use-it.
I loved this article. It is amazing. Keep writing more articles.