CHAPTER 01.04: BINARY REPRESENTATION : Base-10 to Base-2 Conversion Another Method      

 

In this segment what we’re going to do is we’re going to convert our base-10 to base-2 number, but we’re going to follow another approach which is a little bit more holistic in a way, and also self-explanatory, as opposed to the previous segment in which I showed you just the method of converting a base-10 to base-2 number.

 

We’re going to take the same number which we had in the last segment, which was 11.1875 base-10, and we want to be able to convert it into base-2 number. And let’s look at what this different approach is.  You cannot use this successfully for . . . you can write a program for it, but you cannot use this successfully for  large numbers, it will take a lot of time, but it can be done.  I shouldn’t say you cannot use it successfully, I should tell you that it’s going to take a lot more, longer time than the previous approach I showed you.  So what we are trying to do is we are trying to get the equivalent of the binary number for this decimal number, which is 11.1875, and the approach is as follows. 

 

So if I look at the integer part, so let’s  look at the integer part, in base-10, right?  What you’re going to need to figure out is that what is the largest power of 2 which is part of 8 . . . which is part of this 11.  So if you look at 11, you know that 2 raised to the power 0 is 1, 2 raised to the power 1 is 2, 2 raised to the power 2 is 4, 2 raised to the power 3 is 8, but 2 raised to the power 4 is 16. So you know that 16 is not part of 11, so what is part of 11 is 8, which is 2 to the power 3. So what you’re doing is you’re looking at the highest possible power of 2, highest possible integer power of 2, positive integer of 2, which is part of 11. So it’s 2 raised to the power 3, and so that’s 8, how much is left?  We’re left with 3. You do the same thing with 3; you find out that what is the highest power of 2 to a positive integer which is part of 3. So in this case, 2 to the power 0 is 1, 2 to the power 1 is 2, and 2 to the power 2 is 4, so 4 is too much, so 2 to the power 1 is part of it, is the highest power of 2 which will go into 3.  So you have 2 to the power 3 here, which is 8, 2 to the power 1 here, which is 2, 8 plus 2 is 10, you’re left with 1.  And the same thing you do with 1, also, you get 2 raised to the power 3 plus 2 raised to the power 1, plus 2 raised to the power 0, because that’s the highest positive number which you are going to get for 1, 2 to the power 0. And that’s exact representation of 1, and that’s when you’re going to stop, because there’s no longer a need to find out what is the highest power of 2 which will be part of the remaining numbers. So I hope that you followed me here, you got 11 . . . 11, the highest power of 2, positive power of 2, which is part of 11 is 3, so 2 to the power 3. And same thing you do with the remaining numbers, 2 raised to the power 1 plus 1, then 2 raised to the power 1 plus 2 to the power 0.  Now what I’m going to do is I’m going to write down what the coefficients of 2 to the power 3 is 1, the coefficient of 2 to the power 2 is what? It's 0, because there’s no 2 to the power 2 in the representation.  Then you have 1 times 2 to the power 1, plus 1 times 2 to the power 0.  So you see the placement of it, the 2 to the power 3 has the placement of 1, 2 to the power 2 has a number of 0 in its placement, 2 to the power 1 has 1, and 2 to the power 0 has 1. So if you look at this number you’re going to get 1 from right here, then 0 from that number, then 1 from that number, and 1 from that number, and that is the equivalent binary number for 11 in base-2, which is the same number as we got in the previous segment. 

 

So let’s go ahead and look at how do we do this for the fractional part of the number, which is 0.1875.  How do we proceed to find out what the equivalent binary is by using the same kind of philosophy as we have done here?  So if you look at 0.1875, so you’ve got 0.1875 base-10, what you want to do here is that you want to find out what is the highest power of 2 to the power . . . sorry, what is the lowest power of 2 to the power negative number which you’re going to get which is part of 0.1875.  What I mean by that is that you’ve got to look for the 2 raised to the power minus what positive number I’m going to put here, what is the lowest number which I can use. So if you look at the lowest number which you can use for any case would be 2 to the power -1, but that’s not part of 0.1875, right? Because 2 to the power -1 is 0.5.  2 to the power -1 is 0.5, so that’s not part of 0.1875.  If you look at 2 to the power -2, that is 0.25, that also is not part of 0.1875, but if you look at 2 to the power -3, you get 0.125, and that surely is part of 0.1875.  So you see that how we are finding out the smallest negative integer which is going to be part of 0.1875.  So in this case, 0.1875 base-10 will be equal to 2 to the power -3, and what is left over out of 0.125 when you look at 2 to the power -3 of 0.1875 is 0.1875 is the original number, 0.125 has been taken care of by 2 to the power -3. So you get 2 to the power -3 plus 0.0625. So you do the same thing now for 0.0625, find out what is the smallest integer of 2 to the power minus the smallest integer which is going to be part . . . which is going to be smaller than 0.0625.  So we already found out 2 to the power -3 being the part of 0.1875, so it has to be less than that, so if you look at 2 to the power -4, that’s what 0.0625 is. So 0.0625 is exactly equal to 2 to the power -4, so it takes care of all the numbers which you have here.  So now I’m going to put the placement, I get 1 times 2 to the power -1 plus 1 times 2 to the power -2 . . . not 1, but 0, because there’s no place for 2 to the power -1, there’s nothing for 2 to the power -2, so it will be 0 there, then 1 times 2 to the power -3, then plus 1 times 2 to the power -4.  And so the equivalent will be 0, radix point, 00, that takes care of these two 0s, then I have 11, 1 and 1 here, in the base-2.  So that’s what 0.1875 is going to be equivalent to, so you find 2 to the power minus what is the smallest integer here which is part of 0.1875 is 3, then you find out what is left over, and then you do the same process here, in this case it turns out to be 2 to the power -4 there.  So you get that as the equivalent number of 0.1875.  So what this means is that 11.1875 in the base-10 will be equal to whatever is the equivalent of 11, which is 1011, and then the equivalent of 0.1875, which is point 0011, and then it’s base-2, so this is the radix point right there. So this is just another approach of finding out what the equivalent binary notation is for a decimal number.  It’s a little bit more intuitive, you can follow it, because you can make some sense out of it.  So that’s the reason why we talk about this other approach of finding the equivalent of a decimal number to a base-2 number. And that’s the end of this segment.