Converting from Decimal to Binary

Introduction

Since computers and microprocessors do all their arithmetic in Binary and humans tend to use Decimal, we need a way to convert from Decimal to Binary, and from Binary to Decimal. We have already seen some simple example in the previous lessons. An Algorithm is a fancy way of saying a process or list of instructions to achieve some mathematical task. You can also think of it as a recipe for mathematics. In this lesson we will look at three algorithms for converting from Decimal to Binary.

The first algorithm is a left to right algorithm, as it produces the binary number starting at the left end. The other two algorithms produce the binary number right to left. When all three algorithms are finished doing the conversion, the answers are identical

Left to right algorithm.

Here are the steps for this algorithm:

  1. Create a list of powers of two. The list starts like this: 1, 2, 4, 8, 16 and continues till you have a power of two that is greater than the Decimal number you are going to convert to Binary. Note that if your Decimal number happens to be a power of two, and the power of two that is greater will be two times that value.
  2. Discard the power of two that is greater than your Decimal number.
  3. Arrange the list with the largest power of two on the left, and the smallest (1) on the right. These are the values of each column of a binary number.
  4.  

Please watch the following two 4 minute video from Khan Academy.
(for a larger video image, click either on the Full Screen icon in the lower right corner, or the YouTube logo to the left of it)
 

 

Reviewing the comments for the video

 

I see that many people are confused by stuff and more stuff

We will explore this more in a future lesson.4