-
Welcome to the next video in the
binary series. In the previous
-
video we learned how to convert
numbers to floating point
-
notation. In this video I will
show you how to do the other way
-
around, so had to convert a
floating point notation number
-
back into ordinary decimal
numbers. So let's say that you
-
are given an 8 bits floating
point notation, something like
-
1001. 1011 OK,
now the first step that you
-
would do in here is break
this code into it
-
constituents break this
code into its parts.
-
Remember that the first bit
is the sign bit. That's
-
going to tell you if it's a
positive or a negative
-
number. The next 3 digits.
-
Is your exponent?
-
And this exponent, these 3
bits twos complement notation
-
will tell you how many places
you need to move the radix
-
point either in to the right
or to the left and the last
-
part. The last four bits.
-
Is your normalized?
-
Month is self.
-
This is the number that you will
have to apply the exponent two
-
and move the radix point into
-
the right. Place to be able to
decode the binary number so.
-
Step one. Sign because the sign
equals to one. We have got a
-
negative number here.
-
Then Step 2.
-
Exponent Our exponent is
001. Well, that's a positive
-
number because it starts with
zero and it's positive one. So
-
my exponent is positive one, so
I will need to move my
-
normalized mantissa one place
into the positive direction that
-
three. My normalized mantissa is
-
0.1011. Apply the exponent
two. It move the radix .1
-
in the positive direction.
-
So the number the binary number
that is given to me here is
-
one data .011. Now I need to
decode it back into decimal.
-
This is one that's the radix
point. This is 1/2. This is 1/4
-
and this is an 8. So what I have
in here is.
-
1 + 1/4 plus an 8. Remember,
how can we act together?
-
Fractions need to make them to
be the same denominators, so it
-
will be 1 + 2 eight +18,
which is altogether one and
-
three eights. And remember,
we had one to start with,
-
so 10011011 in eight bits
floating point notation is
-
the same as minus one and
three eights in decimal.
-
Let's look at the
next example, which
-
is 11011100 again.
-
The first step is to identify
the sign. Now the sign is 1
-
again. So we have got a
negative number.
-
Then Step
-
2. Find
the exponent.
-
Remember the exponent is 101
now. This is in three Bits 2's
-
complement, so the 1st digit
tells me that this is a negative
-
number. So this is a negative
exponent, so it went through the
-
inversion process. So what I
need to do to find out what
-
positive equivalent is in here
is to redo that inversion
-
process, so copy the number
until you copy the one.
-
Then invert everything else.
-
So that zero becomes one. This
one becomes a 0, so this will be
-
the positive equivalent of this
negative number, and the
-
positive equivalent in here
using the place values.
-
This is equal to
-
R. Three, so this original
number is negative three, so our
-
exponent is negative 3.
-
And that 3.
-
Using the mantissa.
-
Now the normalized mantissa is
the last four bits. Remember,
-
it's always starts with 0.1100,
but what that Azar's done?
-
The exponent was negative three,
so the computer was stored to
-
move it 3 places to the negative
direction. So what does that
-
mean? One place to place
-
three places. Filling the zeros.
-
So the original number
was a very small
-
number O radix .0001100.
-
So what is this number?
-
Use the place values again this
is 1 radix point or half or
-
quarter on 8R16R32 and the rest
of them are zero, so we don't
-
really need to bother about
them. So this number here is
-
basically the sum of the 16th
and the 32.
-
Again, how can I add
fractions together? I need to
-
make them to be the same
denominator, so how can I
-
make 30 twos from sixteens? I
just need to double it.
-
So it's altogether 3 / 32.
And remember I had a negative
-
number because my assignment was
one so one.
-
1011100 As an 8 bits floating
point is exactly the same as
-
minus 3 / 32.
-
Let's do one more example of
this floating point notation and
-
let's look at what number is 0.
-
101
1011
-
Step one, find
-
the sign. The
first bit is 0, so this
-
is a positive number.
-
Then comes Step
-
2. Using
the exponent.
-
Now our exponent.
-
Is 101.
-
Which is a negative number.
-
So again, going through the
inversion process copied the
-
number until your Capital One,
then invert everything else.
-
And. This is again.
-
Positive three so this is still
negative. 3 The difference here
-
now will be that my month is a
is slightly different, so let's
-
look at the last step and deal
with the mantissa.
-
So I'm normalized mantissa
is 0.1011. The computer
-
was told to move
this mantissa or the
-
radix point. Three in the
negative direction, so it would
-
need to move it 123.
-
So 0.00.
So the original
-
number was 0.0001011.
The accompanying place
-
values are one
radix point 1/2
-
or quarter an
8 or 16
-
or 3264 and
-
128th. So I need to
talk together. Now is 1 / 16 +
-
1 / 64 + 1 / 128. Now
again to be able to add them
-
together I need to get them all
to be the same denominator. Now
-
this is a common denominator
because I can get 228 from
-
doubling all of them but at
-
different numbers. So from.
-
16 to get 228 what I've done. I
doubled 123 times. So that is
-
basically 16 * 8 going to give
me the 128. So what this is
-
telling me that 8 / 128 is the
same as 1 / 1664 and 120. There
-
is only one doubling point in
here, so that is just 2 / 128.
-
Plus 1 / 128, so
this is altogether giving me
-
8 + 2 is 10
plus one is 11 /
-
128 so 01011011 in eight
bits within point.
-
Is the same as 11 / 128?
Remember this time it was zero,
-
so this is a positive number and
for positive numbers we don't
-
write out the positive sign.
-
Now we went through the 8 bits
floating point notation and you
-
might find it still a little bit
confusing. That's absolutely
-
fine, because this is like an
orchestra you pulling together
-
everything that you've learned
about binary numbers. So you
-
putting together the two bits
complement notation, some normal
-
mathematical knowledge about
moving decimal places applied 2
-
in binary numbers and so on. So
this is probably one of the most
-
difficult questions that you can
get in binary numbers, but once
-
you understand them then you
will really know.
-
What needed to be known
about this system, and
-
you know how the computer
looks at the binary code.
-
And now it is your turn to try
these conversions. You will find
-
the answers to these questions
shortly after the questions
-
appear. So these are the
practice questions.
-
And here are the answers.