In this segment, we'll talk about how to convert a base 10 number
to a base two number for fixed point representation.
So, let's go and take an example. Let's suppose we have a number like
13.6875 base 10, and what we want to do is we want to find the equivalent number in base 2.What that
will imply is that the integer part will have to be converted to a number in base two, which
will go here. And the fractional part, which is this one, the equivalent will go after the radix
point right here. Let's concentrate on the integer part first, and keep in mind that the procedure
which is being shown here is just being shown as a procedure rather than the why part of it is not
being answered here. So, let's just concentrate on that part in this little lesson. So,
what I will do is I’m going to make some kind of a table so I’m going to say okay number goes here,
then I’m going to have a column for quotient, and then a column for a remainder. And what I’m going
to do is I have this number 13 which I want to convert to base 2. I’ll divide it by 2, and I get
a quotient of 6 and the remainder is 1, right. And then I will take this quotient back here
and I will say hey, let me divide it by 2 and I get a quotient of 3, and the remainder is zero.
Let me take this quotient back here 3 divided by 2 and I’ll get a quotient of 1 and a remainder of 1.
And then let me go ahead and take this quotient of 1 divided by 2 the quotient will be 0 now, and
the remainder will be 1. As soon as the quotient becomes 0, you stop. And that tells you that you
have already converted your number from base 10 to base 2 so far as the integer part is concerned.
So, what we're going to do is we're going to call this to be uh a_0, we're going to call this to
be a_1 we're going to call this to be a_2, and we're going to call this be a_3. So basically,
what it means is that this 13 base 10 actually is the number a_3, a_2, a_1, and a_0. And so,
what that means is that the number is 1101 base 2. So, you start from the last one and you go upwards
if you want to write the number. 1 goes here this 1 goes here this 0 goes here and this 1 goes here.
That's how you have to write the number. You can always confirm this if you go backwards like in
the previous lesson, and you'll find out hey this number here in base 2 is equivalent to the base
10 number 13 here. So, let's, in the next slide, talk about the fractional part.
So, let's look at the fractional part of the number which we had “0.6875”
and we want to see hey what is the equivalent in base two. So, we're going to do is again
I’m going to just go through the procedure here so here is what's going to be my number
I’m going to multiply it by 2 and then what's going to happen is that I’m going to look at hey
what is the fractional part of this number once I multiply by 2, and what is the integer part
after I multiply by two. So, I’m going to take 0.6875
and I’m going to multiply by 2, I get 1.375. I'm going to look at the fractional part is
0.375. What is the integer part? It is 1. So, I write it down here. Now I take the
fractional part only here and I’ll multiply it by 2, what will I get? I will get 0.75.
So, the fractional part is 0.75, and the integer part is 0. Let’s go and take the 0.75 now, which
is the fractional part right here, multiplied by 2, I get 1.50 so the fractional part is
0.50 of this number, and 1 is the integer part. Now I take this fractional part here put it here,
multiply it by 2, I get 1.0, here the fractional part is 0, the integer part is 1. Now in this
case, as soon as this fractional part here this part right here becomes zero, you stop.
However, in many cases when you have the fractional part, you may never be able to
stop. Say, for example, 0.1 base 10. Or, 0.2 base 10, let’s suppose, and try to convert it into
base 2 you'll find out that this process which I’ve just shown you
will never give you the fractional part to be 0 here. Hence, it'll be never ending.
So how do we now say that hey how do we write the equivalent uh number here?
Now what you got to think about this is a_-1, this is a_-2, this is a_-3, and this is a_-4.
So, what’s going to happen is that 0.6875 base 10 is going to be equal to you know this number here,
with the radix point in the front and these integer parts which will represent it.
So, we'll have radix point here and then we'll have “1011” base 2. That is the equivalent of
0.6875 base 10. And you can always confirm it by going the other way and see what happens. So,
we have the original number was the exercise which we were asked to do is hey 13.6875
base 10, what is it equivalent to? Then we already know that 13 is “1101” from the previous slide,
and in this slide, we have “.1011” base 2. So, this is what goes here, for the fractional part,
this is equal to 13 from the previous slide. And that's how you write the fixed-point
representation of this decimal number in base 2. Keep in mind that this point here is called the
radix point. If you go backwards see that hey what is the decimal equivalent of this number,
you can always do that and confirm that hey this really is the number which is being represented.
And that is the end of this segment.