Hello everybody, welcome back to the online
course on Computer Organization and Architecture.
Now we are in the module of fundamentals of
digital computer now we are in unit 3 and
unit 3 is basically related to information
representation and number system. In this
unit we are going to see how we are going
to represent information for digital computer
and the number system that we are going to
use for our arithmetic.
So, first of all we are going to state the
objective, what is the unit objective of this
particular module?
So, the first objective is illustrate the
number system of different radix system. So,
this is in the knowledge level. So, we are
going to discuss everything in the knowledge
level. So, that we will have the knowledge
about the number system and we can use these
things in digital computer.
Objective 2, describe the method for integer
representation. So, this is in the comprehension
level. So, when we see these things you will
be able to understand how we are going to
represent integer in computer system. Objective
3, illustrate the method to represent the
real numbers. This is also in comprehension
level we are going to see how we are going
to deal with real numbers in computer. And
objective 4, describe the representation of
character this is also in knowledge level
we are going to see how we are going to represent
character in computer because we have to deal
with data processing and many a time we are
going to work with string manipulation.
Now, first we are going to talk about the
number system.
I think all of you know about the decimal
number system where the base of this number
system is 10 or in general we say radix system.
Consider an example of decimal number say
75 and I just ask you if you have written
as 10, it means that the base of this number
system is 10. So, now, 75 how we are going
to evaluate the value of 75, it is 7 × +
5 × , so 70 + 5 this is 75.
Now, what is the binary equivalent of this
particular 75? Now whatever we are going to
do eventually we should get 75. So, I am not
going to discuss about conversion just I am
giving an example. So, 75 in decimal number
system will be represented with 1001011 in
binary number system. So, when we talk about
the binary number system then the radix or
base of the number system is 2 which is given
in the subscript over here.
Now, in base 10 system it is of radix 10 and
it is a multiple of 10, but in case of your
binary number system it is multiple of 2.
So, in that particular case now we are saying
that fifth is the 0th position, 7 is the unit
position of our decimal number system. So,
similarly here also we are going to have this
position this 1 is the 0th position like that
1 2 3 4 5 6. So, this 1 is in the 6th position.
So, ultimately what is the equivalent value
of this binary number? 1 × + 0 × which is
0 + 0 × which is 0 + 1 × + 0 × + 1 × +
1 × . So, this is = 64, is 8, 64 + 8 72,
is 2, 72 + 2 is 74 and 1, so + 1, 75. So,
eventually we are getting the decimal equivalent
75. So, in this way we can represent every
numbers every decimal numbers in binary representation.
Like that we are having different radix system
and as for example, I am giving another base
system which is your 8 base is 8. So, now
if you consider this 75 in decimal number
system that equivalent octal number system,
so base 8 number system is known as your octal
number system it is 113 so that means, 1 × +
1 × + 3 × . So, 8 square is 64 + 8 = 72
+ 3 =75. So, this is the way we can have a
conversion from one number system to another
number system.
Decimal to any other number system is very
easy very simple what we can do, simply divide
that number by that particular base. So, in
that particular case 75, so this is in radix
10 or base 10 we want to convert it to octal
number system. Then what we are going to do?
We will divide it by 8, 8 9s are 64 and remainder
is 3 again we are going to divide 9 by 8,
8 1s are 8 and remainder is 1 again we are
going to divide it by 8 then result is 0 remainder
is 1. So, in that particular case we are going
to get 113 in octal number system. So, 75
in decimal number system is equivalent to
113 in octal number system. This is the way
we can represent or we can convert every decimal
number to any other radix system. So, similarly
when we are going for a binary number system
then 75 will be divided by 2 and in that particular
case now where we are dividing again this
is coming in the unit position and like that
it will increase. So, it is 113.
So, now when we are going to talk about a
number system we are having two terms called
least significant bit and most significant
bit MSB and LSB this is basically when we
are going to talk about the bit it basically
talks about the binary number system we are
going to take single bit. But for any radix
system we can say it is a most significant
digit and least significant digit. As for
example, in your 113 in base 8, 3 is the least
significant digit and 1 is the most significant
digit in this particular case because you
just see that this 1 is multiplied by . So,
weightage is more and these 3 is multiplied
by which is one. So, weightage is less, so
in that case we having that least significant
digit as 3 and most significant digit as 1
for 113 in octal number system. Similarly
when we are going to talk about the binary
number system we say it is least significant
bit and most significant bit.
So, in this particular case the one or bit
that we are having a most right hand side
is known as your least significant bit because
it is weightage is less and the one that we
are having in the left hand side most left
hand side is your most significant bit because
the weightage is more over here 2^6. So, this
is the convention about the least significant
bit and most significant bit.
Now, how many numbers or how many symbols
we require for a particular number system.
So, it is basically related to the base of
the number system. So, if we are using a decimal
number system decimal number system in that
case base is 10. So, to represent these things
we need 10 different symbol and we know that
those symbol we are using 0 1 2 3 like up
to 9 we are using. So, these are the 10 different
symbol that we are using in decimal number
system. So, in case of binary number system
since base is 2 we need only 2 symbols and
that 2 symbols that we are using in binary
number system is your 0 and 1. So, the binary
number is represented with the help of 0s
and 1 only.
When we come to octal number system in that
particular case the base is 8. So, we need
8 different symbol. So, what are the symbols
that we are using? We are using from 0 to
7 these are the 8 different symbol we are
using in octal number system. Like that we
can go for any radix or any base. One important
number system that we are having is your hexadecimal.
So, in computer system sometimes we represent
our information in hexadecimal form. So, in
hexadecimal the base is 16, so we need 16
different symbols. So, in hexadecimal system
the base is 16 and we need 16 different symbol
to represent it. Now, what are those 16 different
symbols that we use in our hexadecimal number
system?
So, from 0 to 9 we are using those symbol
to represent 0 to 9, 0 1 2 like that since
it is having base 16 so, we can represent
16 different numbers in this particular number
system. So, 0 to 9 10 is gone now you are
having 6 number 10, 11, 12, 13, 14 and 15.
So, to represent those number in hexadecimal
system we use the letter from our alphabet
and these letters are your A, B, C, D, E and
F. So, this is the symbols that we use in
our hexadecimal number system, so 0 to 9 ten
digit and A to F six characters, total 16
character.
So, if we write some numbers like that say
D12. Say this is a hexadecimal number and
we are using the symbol. What is the decimal
equivalent of these things? This is your D
is your 10, 11, 12, 13. So, this is 13 × +
1 × + 2 × . So, whatever we are going to
get this is the decimal equivalent of this
particular hexadecimal number. So, conversion
from any number system to decimal number system
is very easy. So, like that from decimal also
we can convert to any number system just by
divide by the base of that number. So, this
is the way we can just represent our numbers.
Now, we are going to see how we are going
to represent integers. So, this is 0s and
1s only. So, we will say whatever we are representing
we say it is a bit and bit is nothing but
binary digit; that means, we are representing
0 or 1. So, these are the binary digit.
And already we have seen how we are going
to write numbers in binary number system.
So, for example, here we are giving 41. So,
in that particular case, 41 is having binary
equivalent 00101001 so that means, we can
say that this is these are the 3 ones are
coming. So, these are going to have going
to give us the effect so, it is basically
+ + , 0 1 2 3 4 5. So, is 32, 2 cube is your
8 + is one. So, this is equal to 41. So, this
is the way we are going to represent our integer
in binary number system.
So, there are some issues now we have to see
how to give the - sign to have the negative
numbers, how to put a decimal point for real
numbers and secondly, we have to see what
is the range of numbers. Ok so, basically
say if I ask you to do something with pen
and paper then you don’t have any limitation,
but when we are going to work to our digital
system or we say at we are going to work with
digital computer then always we are restricted
by a range and this range depends on the bit
number of bit that we are using to represent
the number.
So, in this particular case of 41, in this
particular case we are using 8 bits. So, when
we are using 8 bits; that means, we are restricted
by a number up to a particular limit only
we can go. So, if we increase the number of
bit then we can go for more ranges and. Secondly,
we are going to see how we are going to represent
the negative numbers there have been two way
of doing it one is your sign magnitude and
second one is your 2’s complement. Just
as an example I am giving here is a size of
my data.
So, if you are walking with your size 8; that
means, you are working with the data size
of 8 bit. So, in that particular case the
combination may be all 0s to all 1s. So, in
that particular case all ones is going to
represent can you calculate it this is your
0 to 7; that means, + + + + + + + . So, this
is your 1, 2, 4, 8, 16, 32, 64, 128. We have
to be you have to be accustomed with this
particular 2 to the power of something because
many a time we are going to look it. So, this
is I am going to get 128 64 32 16 8 4 2 1
and if I add up all those things I am going
to get 255. So, when we are going to work
with 8 bit numbers then my range will go from
0 to 255.
Ok, similarly if I am using a 12 bit numbers
now my range is going to increase like that
if I am going for 32 bit numbers; that means,
we are going to work with 32 bits at a time.
So, nowadays we used to say that my computer
my processor is a 32 bit processor; that means,
I can work with a 32 bit numbers. I say that
my computer is or my processor is a 64 bit
processor then we can handle 64 bit at a time.
So, in that particular case we can say that
these are binary representation for 8 bit
this is the minimum number this is the maximum
number if we are going to work with a positive
line only and if this is 32 bit this is the
minimum one this is the maximum one. So, my
range is in decimal is for 8 bit numbers it
is from 0 to 255 for 12 bit number it will
0 to 4095. So, this is 4095 and when I am
going for 16 bit number it is 0 to - 1 basically
255 is nothing but I can say - 1, is a 256
- 1, 255 and if it is your 20 bit then into
go up to - 1 and in case of 32 bit it will
go to - 1.
So, the similar information I am representing
in another number system which is your hexadecimal.
Now, you just see what I am saying this is
your 8 bit number all 0s to all 1s. So, all
1 in decimal it becomes 255 in hexadecimal
it is your FF, FF means 15 F represents 15,
15 × + 15 × . So, in that particular case
we will get that this is nothing but 255 in
decimal.
Now, when we are going to discuss that representation
of number in computer or in your binary system
or binary digit most of the time we are going
to take help of hexadecimal number system
because it is having one advantage. Say, when
I am going to work with 32 bit number I have
to write 32 bits ok all 32 bits 0 or maybe
combination of 0s and 1 which is slightly
difficult. Similarly when we are going to
work with 8 bits we are going to write 8 bits
all 0s to all 1. Now, again if I see how to
do it in your decimal number then we have
to have slight your these things calculation
now this is the calculation we have to do
which is slightly time consuming for any number.
So, in that case for hexadecimal representation
this very simple, you just see if I am having
a 4 bit number then all 0 if I am having then
this is your 0 and if it is all 1 you can
say that 8 + 4 = 12, 12 + 2 =14, 14 + 1= 15.
So, this is your 15 so we need total 16 different
symbol 0 to 9 and A to F, F is 16 and A is
10. So, now, to represent this number the
maximum number of bits that we need is your
4 bit. So, when we are having a binary representation
we simply group them in the 4 bits. So, in
that particular case what will happen? We
are going to say that this all 1 is going
to represent F and all 1 is going to represent
F. So, the range is from 00 to FF, when we
are having 12 bit numbers then it will go
from 000 to FFF. So, number of bit divided
by 4 is going to give me the number of symbols
needed for hexadecimal representation.
So, if I go back to one of my earlier slide.
So, in 41 I am saying that this is the binary
representation now what is the hexadecimal
representation 0010 this is your representing
2, 1001 this is basically 8 + 1= 9, so 29.
So, 41 in decimal number is equal to 29 in
hexadecimal number system or in binary number
system we can say 00101001. So, if you are
going to work with 8 bit numbers we have to
write 8 symbols in binary presentation, but
in hexadecimal we are going to use only two
symbol two digits. So, in most of the time
we are going to represent our information
in hexadecimal for understandability and for
readability, but when you think about how
it is working in the computer basically it
working with this particular binary digit
only in bit pattern 0s and 1s, but for readability
we can write something in our hexadecimal
notation.
Now, how to represent integers? So, in that
particular case we are talking about the number
system. Now, say if I am having 8 bit numbers.
So, I am having a combination of 0s and 1s
and 8 bits 8 symbols. So, in that particular
case we are having 256 different symbols or
combinations, so this combination will go
from 0 to 255.
Ok, so if we are going to represent only positive
numbers then what will happen I can use all
those 256 character to represent positive
numbers from 0 to 255, but if you are going
to consider about negative number also this
is the number line this is 0 and this is your
positive side and this is your negative side.
So, when we are going to work with a negative
number then what will happen whatever 256
different bit patterns we are having some
of the bit patterns need to be reserved for
negative numbers also; that means, in positive
number when we are on the dealing with positive
number then we are going from 0 to say 255.
But when you are coming for negative numbers
then some of those symbols have to be used
for negative numbers also; that means, gradually
my range is going to reduce in the positive
side maybe it will be half over here. So,
I can say this is your 127 and this side I
may have 127. So, this is basically 127 +
127 254 with 0 255. So, we are having total
256 symbols, but here we are using 255 one
more symbols are still remaining. We will
see how we are going to deal with that particular
representation.
So, basically we have with 8 bit numbers we
can handle 256 different numbers. So, if it
is your only positive numbers we are going
to deal from 0 to 255, but if we are going
to handle negative numbers then range will
reduce it will go from some negative 127 to
positive 127 or may be + - so on.
Now, for that we are having 2 ways of representing
this number one is your sign magnitude in
that particular case what will happen whatever
bit pattern we have it will be divided into
two part one part is known as your sign and
other part is your magnitude. So, in that
particular case what will happen? Say, for
8 bit numbers one bit will go for your sign
and 7 bit will go for magnitude. So, if it
is an 8 bit numbers. If it is a 16 bit numbers
then 1 bit will go for sign and 15 bit is
going to represent the magnitude of that particular
number. So, here what happened what convention
we are using 0 means the positive numbers
and 1 means the negative number. So, in that
particular case for example, you just see
+ 18. So, this is the magnitude 10010 this
is + 16 + 1 18. So, similarly this is the
magnitude of the number again it is 18, but
now we are saying that 0 is my indicating
the sign with it is a positive number. So,
it is + 18 and this bit more significant bit
is 1, 1 represent the negative numbers. So,
this bit we are having going to give me - 1.
So, in that particular case now we can represent
the numbers positive number as well as negative
numbers.
Now, in that particular case now what will
happen, if you take this particular 7 bit
then it can the value that numerical that
it can have go up to 127. So, with 0 I can
go up to +127 and with most significant bit
1 we can go up to 127. So, this is 127 + 127.
So, total 254 now we are having total 256
bit pattern what is the remaining bit pattern
you just see that if you look into it what
we are getting we are having that bit pattern
1 2 3 4 5 6 7 all 0 this is representing 0
or maybe one. So, this is also if you look
into this magnitude, magnitude is always 0,
but with this bit 0 and 1 we are getting positive
0 and negative 0; that means, there are 2
representation of 0. So, in this particular
case we are representing 256 different numbers,
but out of that valid numbers is 255 we are
having 2 representation of 0. So, there we
may look to eliminate this also because why
we should use two bit pattern to represent
the same number, so for that we may go for
some other representation which is known as
your two’s complement.
So, in this two’s complement just I am giving
one example just only getting phone numbers
now in that particular case what will happen
this is the representation if I am having
0 then these are all 0s, + one is simple that
magnitude 1, 10, 11 like that if I go for
positive 4 then it will be 100 like that and
negative number is coming as - 1 is representing
as your all 1s then - 2 is coming as your
all 1 and 0 and - 3 is coming as your all
1 after that six 1’s 01.
So, basically what happens? It is basically
the maximum number is a 255 or 8 bit representation
that 255 is going to represent my -1 now you
just count down and go downwards then 554
is going to give me -2, 253 will give me your
-3, then 252 will give me -4 like that and
from 0 if you go in upward direction say 1
is going to represent 1, 2 is going to represent
2, 3 is going to represent 3 like that. So,
this is the simple way we can visualize it.
So, if we are having a number in two’s complement
form we are going to represent in this particular
way.
Now, how to do it? We are having one is called
one’s complement and two’s complement.
So, if I consider a particular number say
00000011 this is a number that I am considering
then what is the one’s complement, one’s
complement basically it says that you complement
all the bits of this particular number. So,
I am going to get 11111100. So, this is the
one’s complement of this particular number.
And what is two’s complement it says that
in case of two’s complement whatever we
are getting in one’s complement add 1 to
it. So, what I am going to get 11111101. So,
this is the two’s complement.
Now, if this is my some number given number
I can get the one’s complement just complementing
all the bits and I think in digital system
we can do it by using a NAND gate or maybe
using a NOT gate that we have discussed these
things our digital block. So, after that we
are going to add on to it finally, we are
going to get it. Now if I go back to my previous
slide you just see that we are talking about
we are taking this particular number one.
So, if I am going to take the ones complement
I am going to get 11111100 now if I add 1
to it then I am going to get 11111101. Now,
you just see whatever I am getting or taking
the number after looking into the two’s
complement I am getting this representation.
So, generally we are saying that this is my
positive 3 and other one is my negative 3.
So, after taking the ones two’s complement
we are going to get the negative representation
of the given number. So, this is the task
that we are going to see and why we are coming
with this particular number system and why
we call it complements you just see that I
am taking this particular number 00000011.
Ok, now I am taking the two’s complement
what I am getting 11111101. Now, in that particular
cases I am going to add this two numbers then
what I am going to get 1 and 1, 0 we having
a carry 1, 1 and 1 0. So, I am getting a carry
one. So, and finally, 1 carry out. So, we
are getting this number.
Now, what will happen we are working with
8 bit numbers; that means, we are having provision
to store this particular 8 bits only and this
is a carry out which is not a part of my number
because I can represent the number with the
help of 8 bit only. So, carry cannot be incorporated.
So, we are not going to consider this particular
1. So, finally, what I am getting the after
adding this number we are getting 0. So, when
we add two numbers and if the result is 0
then what we say that one is the negation
of the other because if I add two numbers
a + (- a) then we are going to get result
is 0. So, this is the principle that we are
using. So, in two’s complement form we can
use we get the negative of a given number
or if we are giving a negative number then
we are going to get the positive of that particular
number.
So, we are going to use this number. This
is related to any number system see what we
can do if I look into these things that binary
decimal number system also in that particular
case also we can have this particular concept
of complement. So, in that particular complement
here we are saying that just take the complement
that means 0 will be replaced by 1, 1 will
be replaced by 0. This is basically the subtract
the number from the maximum digit that you
have in that number system. So, this is basically
1 - 0 is going to give 0. So, now, if I take
any decimal number system say 27 then what
we are going to do, we are going to subtract
this number from the maximum digit which is
9. So, 9 - 7 is going to give me 2, yes I
am going to say that this is 37. So, this
is your 9 - 3 is 6, ok 62 now if I am going
to add 1 to it then I am going to get 63.
Now, we add up 37 and 63 what we are going
to get 0 9 10. Now, we are working with two
digit only the way here we are working with
8 bits we are using two bits two digit only.
So, this digit cannot be stored. So, eventually
what will happen adding this two number is
going to give me the result 0 so that means,
we can say that one is the negation of the
other if we are using the number system your
10’s complement. So, for decimal number
system also we can use that complement 10’s
complement in case of 10’s complement first
we are going to get the 9’s complement the
way we are getting the one’s complement
this is the 9’s complement and after adding
1 we are going to get the 10’s complement.
So, this is the principle we are using to
represent the negative numbers. So, already
I have explained these things what is the
benefits. So, in this particular case first
take the complement of given number then add
1 to the LSB then we are going to get the
negation of that given number.
Now, what already we have seen?
This is a special case already we have seen
that now in that particular case negative
0 is equal to a positive 0; that means, you
having only one representation of 0. So, in
sign magnitude form what will happen we are
having -127 to +127 total 256 number along
with that two representation of 0 2. So, total
256 symbols.
Now here in this particular case after adding
it since we are going to discard this particular
carry out bit because we cannot store it because
we are working with 8 bit numbers. So, finally,
positive 0 and negative 0 is becoming same.
So, we are having only one representation
of 0.
Other one you just see what will happen now
in that particular case if I am going to look
for this particular combination because it
is coming don’t know what I am saying that
you start with all 1 then 11111110 like that
you decrease it and finally, we are going
to get this particular number. So, for this
particular number if I take the one’s complement
then I am going to get this representation
and 2’s complementation I am going to get
this particular number. So, basically two’s
complement should give me the negation of
that particular number. So, if this is a particular
representation then we should be the negation
of this thing, but both are standing up to
be same. So, this is a special case and we
are going to handle it as like that this representation
will be treated as your -127 oh sorry -128.
Now, why we are taking -128 why we are not
taking these things your +128 because this
is an extra symbol know we are getting -127
to 0 and to +127, now these are the 255 different
bit pattern we are using now this is the bit
pattern it is remaining there. So, we can
use this particular bit pattern to represent
another number and we are saying that we are
representing it as a -128, but why not +128.
So, in that particular case you will find
that just concentrate on this particular most
significant bit it is 1. So, in the representation
when we are going to represent the number
with 2’s complement we will find the positive
number should start with 0; that means, most
significant are bits are 0 and negative numbers
will start with 1; that means, most significant
bit is a 1.
Since this bit pattern is staring with 1 so,
if we are going to treat this as a negative
number then we say that it is going to represent
-128 not +128; that means, now my range is
go from -128 to +127 total 256 different representation.
So, if we come back to this particular slide
you see that for negative numbers this most
significant bit is always 1 and for positive
number this most significant bit is 0. So,
that’s why when we are coming for this particular
special case 1 all 0s that will represent
a negative number and the negative number
is your -128. Now, what is the range of number?
Already I have mentioned it. So, in that particular
case, for integer sorry for positive number
we can go from 0 to 256, 255 if it is an 8
bit number. So, for negative numbers if we
are going to handle a complete range of integers
positive and negative then for 8 bit numbers
the range will go from -128 to +127.
And for 16 bit number 
it will go from 32768 to 32767. So, -32768
to +32767 and basically it is in - 1 this
is - 1 because we are using 7 bit to represent
my magnitude and this bit again a going to
give me the indication about negative and
positive number. So, it is basically - 1 to
- . So, if we are going to work with n bit
number then my range will be your
–(– 1) to - 1. So, this is the range that
we are going to have when we are going to
use two’s complement form.
So, this is just in a tabular form we are
writing this two’s complement number in
4 bit numbers.
So, this is your 0 then 7 this are the positive
number and -1 will represent at the all 1
and this decremented and finally, -8 will
be your 100.
Now, just look for some operations say I am
giving that 7 + 7 now how we are going to
edit 7 it is a 4 bit numbers just remember
that we are having a 4 bit numbers. So, 7
is a nothing, but 0111, 0111. So, this is
7 and 7 now if I add them then what I am going
to get 0111 ok this is the things that I am
getting. Now you just see that -7 + -7 now
what is the representation of - 7 its two’s
complementation 1001, 1001. So, this is your
1001 and 1001. So, if I add them what I am
going to get 01001. So, this is your carry
out we cannot consider it because we are working
with 4 bit number.
Now, considered that 7 + -1, 7 is your 0111
and what is -1, -1 is this all 1 1111, now
this is your 01101 again I cannot consider
these things and 1 + -7 so, 1 is your 0001
and what is my -7, 1001 1001. So, this is
your 0101. Now, you just see what we are getting
actually. So, in this particular case this
is your +7 this is your +7 now we are working
with two’s complement. So, 1110 what does
it means 1110 is your -2 here this is your
-7, -7. now 0010 what I am getting 2 these
are decimal equivalent this is your 7 and
this is your -1.
So, what I am getting 0110 which is your 6
this is your 1 and this is - 7. So, what I
am getting 1010. So, what is that 1010 is
your - 6. So, I am getting - 6. So, just I
am calculating it just show it now what will
happens say when I use - 7 to - 1 should get
- 6 and I am getting it. So, this is a correct
result when I am using this things - 7 and
- 1 I am getting + 6. So, this is also correct
result, but when I am using - 7 + - 7 what
should be my result my result should be 14,
but as a result I am getting 2 only. Again
when I am using + 7 and + 7 I should get +
14, but what I am getting over here I am getting
- 2.
Ok so, in this particular case, whatever result
we are getting these are not correct because
we have working with 4 bit numbers and you
can handle 4 bits only. So, in that particular
case these are not the correct result because
we know that for 4 bit numbers my range is
from - 8 to + 7. So, this is the range, but
these are the valid numbers but after adding
I am getting a bigger number if it is a positive
result say which is your 14 no doubt about
it, 8 + 4 + 2, but since we are going to handle
negative number. So, eventually it is represented
as - 2. So, these are the two result at I
am getting which is not correct and this situation
is basically known as our overflow because
we cannot handle + 14 over here this is the
range. So, this is your overflowing the number.
So, this is the overflow situation, but in
these two cases I do not have any problem
and what I am getting that correct result
these are the two correct result.
So, this is basically we should talk about
the overflow situation; that means, we are
trying to perform some operation computer
is doing it or digital system is doing it
and essentially it is giving me some result,
but this result is wrong I cannot consider
it. So, we are going to say these are the
overflow situation. Secondly, if I look for
this particular four calculation one thing
you just see that here it is having a carry
out this one is also having a carry out it
is generating some carry, but other 2 combinations
are not generating any carry bit this carry
out is 0. So, in that particular case what
we will say that these two operation is generating
some carry for me, but one is your correct
result second one is not correct result. So,
we are having some situation called whether
after performing some operation whether it
generates carry or not or secondly, whether
it is a valid result or not, if the valid
result is not valid then we say it is an overflow
situation. So, these are the terms we are
going to use while going to design our computer.
Now, another important issue you just see
that I am giving, one more question that you
perform 7 - 5. So, in that particular case
how we are going to perform this operation
7 - 5 I know that this can be done with your
7 + - 5. What is 7? A binary representation
0001. And what is the representation of - 5?
1011, 1011. If you add these two things then
what you are going to get 01001. Ok 7 - 5
is 2. So, I am getting 5 only. So, this is
your 7 and this is your - 5 because we know
that result is 2 I am getting it.
Now, what is the observation over here? You
just see when we are representing in two’s
complement form to do the subtraction we can
use the adder circuit itself just take the
negative representation of the number and
after that add them together and this is the
way we used to do. So, in two’s complement
form if we are using two’s complement representation
basically adder circuit can be used to evaluate
the subtraction also. So, in this particular
case 7 - 5 we are getting result is 2 and
you just see that it is also generating 1
carry. So, carry generated, since it is a
valid result so it is not an overflow. So,
this is also valid result.
Now, when we are going to say that it is an
overflow just you observe this particular
result and from that we can conclude it actually
you just see that this is having carry 0 and
this is your carry out is 0. So, in that particular
what I can say that carry into the most significant
bit and the final carry out. So, this is the
carrying to the most significant bit and this
is the carry out this is the carry in to the
most significant bit and this is the carry
out. So, these are overflow situation this
is the carry in to the most significant bit
and this is the carry out of the operation.
Here also this is the carry in to the most
significant bit and this is the final carry
out now you just see in these two situation
these are my correct result. Here also I am
having this ok now the observation is like
that if the carry in to the most significant
bit and the final carry out if they are same
then we don’t have any overflow say these
are the same situation.
Ok these are the same situation. So, we don’t
have overflow, but in case of overflow these
2 bits are different say it is 0 and final
carry out is 1 it is your carry in is your
1 and final carry out is 0. So, if these two
situations are different then we are going
to get an overflow and this is nothing, but
my exclusive or scenario; that means, with
the help of an exclusive OR gate I can check
whether overflow occurs or not. So, what I
can say this is the carry out and this is
the carry out final and this is the carry
in to MSB most significant bit which is a
sign bit. So, with the help of this exclusive
OR gate we can detect whether overflow occurs
or not.
So, these are the situations. So, what I am
saying that here I am talking about overflow.
So, this is the way I can detect the overflow.
I have seen whether it has generated carry
or not. So, with this carry out bit I can
check whether carry has been generated or
not and sign bit what is the sign of the result
basically this most significant bit is going
to give me the sign bit ok. So, I will just
look into this particular position and see
whether the number is positive or negative.
So, since it is 1, it is a negative number
and this going to represent - 2, since this
bit is 0 so it is going to represent positive
numbers so this is + 2. So, like that these
are the three information we can collect when
I am going to perform addition operation in
two’s complement form and we require those
information while implementing of computer.
So, we have seen how to represent positive
numbers how to represent integers; that means,
positive as well as negative. Now we are going
to see how we are going to represent the real
numbers.
So, how we are going to represent real number
it is again everything we have to deal with
your binary number system only 0s and 1s and
you should know what is the decimal equivalent
of a real numbers if we are going to represent
it in your binary number system.
So, in that particular case just look for
the particular simple example. So, this is
the decimal point, so that is why these are
the fractional point. So, how we are going
to get it this number is your + and this are
decimals. So, this is + , , and. So, this
is your 4 + 1 this is 9. So, now 1001 is 9
and is your 0.5, this is your , 
what is your this is your 0.25 half of this,
this is half of this, so 0.125. So, this is
basically 0.5 + 0.125. So, this is your 0.625.
So, finally, my number is your 9.625. So,
this is the decimal representation and finally,
we are in this binary representation. So,
everything we have to do binary representation.
Now, main issue is now where I am going to
keep this particular decimal number. So, if
it is like that I am having a 8 bit numbers
we are keeping 4 bits for before decimal and
4 bits after before decimal then what will
happen then I can go up to 15 only it is your
positive number and if it is your negative
number then I can go from - 7 point something
to - 7 point something and what is that point
something we can simply add those particular
numbers and we can get it. So, if I am going
to have this things we will say this is a
fixed point we have finding or we are putting
the position of the decimal point as a fixed
one and it will always appear at a fixed position.
But it is very limited in computer system
I am not using it, but another one is moving
means it is according to our numbers we will
adjust the particular decimal point which
is basically known as floating point number
fixed point representation and floating point
representation. In case of moving it is basically
floating point representation and I think
if you are writing some problem in your C
language I think you know about the floating
point number. So, this is the floating.
Now, how we are going to do it? This is basically
in floating point number we use this particular
representation. So, most significant bit is
always used to indicate the sign bit whether
it is positive numbers or negative numbers
0 means positive 1 means negative then we
are having some exponent part we say it is
a biased exponent we will see and we are having
the significant part. Ok that means, if I
am going to represent in decimal number system
say + 23 × then what will happen, this is
the exponent part and this is the significant
part or the mantissa part. So, this is the
number presentation if they having + - then
decimal point sorry here decimal point will
put it over here and into 2 power exponent.
So, always decimal is having over here.
Now, this is the way we are going to represent
now in negative binary number system also
those things will be represented in my binary
number system. So, it is having exponent part
and significant or mantissa part and along
with that sign part.
Now, just look for this particular representation.
So, what is the size of this particular representation
this is your 32 bits 1 bit is for sign bit,
8 bit is for your exponent and 23 bit is for
significant. So, now, if we look into this
number representation say 1.10100001 into
2^10100. So, if this is the number that we
want to represent in our floating point represent
then what will happen, in that particular
case we have to see what is the significant
part the significant part is your 1010001,
1010001, so 10010001. So, this is the significant
part and it is having total 23 bits. So, remaining
part will be all 0s.
So, this is basically same numbers positive
and negative positive exponent and negative
exponent now what is the exponent over here
you just see here I am talking about 2 to
the power. So, this is your 1 2 4 8 16, so
16 + 4, 20. So, basically we are talking about
2^20. So, this is the representation 2^20
and if I convert it it will come like that
in decimal equivalent the value.
Now, in this particular case we are having
2^20, but what we have stored over here you
just see what is this equivalent 1 2. So,
basically this is your 1 2 4 8 16 + 32 64
128. So, finally, this is the number that
you are getting, so 128 + 19. So, we are getting
147. So, what we are storing basically in
the exponent part we are storing 147, but
basically we are looking for 20, 2^20, but
instead 20 we have storing it your 147. So,
this is called biased exponent because now
exponent may go positive as well as negative.
So, instead of doing this thing what will
happen we represent everything in the positive
number and it will be biased by some numbers.
So, in this representation it is biased by
128; that means, whatever number we are storing
over here that will be that to find out the
exact exponent that 127 will be subtracted
from that. So, 147 - 127 what I am getting
this is 20, so this is the 20 that we are
getting. So, this is the biased exponent.
Now, just look for the negative now this is
a negative exponent this is your - 20, but
for - 20 what we are storing 1 + 2 + 8, 8
+ 16 + 32 + 64. So, these are the things that
we are storing in the exponent. So, what I
am getting 96 + 8, 104 + 3, 107.
Ok now, we are storing 107 in the biased exponent.
So, what is the exact value we are storing.
So, what we have to do we subtract 127 from
107, 107 - 127, so we are going to get - 27.
So, this is the way we are storing our floating
point numbers. So, it is having 3 component,
one is your sign bit then biased exponent
and significand and what we are storing you
just see observe these things we want to store
1.1010001 and we have stored this particular
information in the significand part. We have
not stored that 1 and decimal point; that
means, we are not going to store the decimal
point it is implicit and what is the decimal
point whatever we have stored in a significand
that will be appended by 1 point that number.
So, this is 1 point something then what happen
we are not storing it this information whatever
we have stored that will be always consider
as 1 point that number.
So; that means, if I am going to give going
to store some number then what will happen
first we have to normalize it and the normalization
will come like that decimal point will be
always after 1 digit. So, this is the normalization.
In decimal number system also we do the normalization.
So, these are the things that we are having.
So, mantissa will be stored in your 2’s
complement form exponent will be stored in
your biased exponent. So, this is basically
it will be stored in a biased exponent and
after that what happen some values we need
to subtract it may be from 128 or 127 for
8 bit numbers.
So, we must understand this 3 component while
we are going to find out what is the exact
value that we are storing in this particular
representation. So, for this particular representation
say if I want to store this particular number
1.638125 × basically in binary representation
we are going to have these things. So, for
that this part we are going to put in the
mantissa or the significand part and whatever
we are having this particular exponent it
should be according to the bias that we have
used here we have used bias as 127. So, whatever
value we have we have to add 127 to it and
store that particular number as an exponent
and along with that we are going to store
the sign bit.
So, if you know the information then very
well you can find out what is the value of
this particular number and how we are going
to get the value, basically it is in normalized
form this particular information 1 and dot
we are not storing that remaining part we
are storing. So, this is the way we are going
to do it.
Because this is similar thing, whatever we
are talking about. So, in floating form number
it should be usually normalized that is exponent
is exhausted. So, that leading bit MSB of
mantissa is 1. So, leading bit is 1. So, this
is similar to your decimal number system say
if I am going to talk about say 5123 I can
look for 5.123 × . So, this is the way we
have to look into it. So, it have to be first
normalized one, the number is there is only
1 bit prior to that decimal point and after
that we are having a mantissa and exponent
whatever exponent we are going to store it
should be in the biased form because why we
are teaching the bias notation just to avoid
the negative numbers represent store negative
numbers in the exponent point.
Now, what are the ranges of your floating
point numbers? Again it depends on the number
of bits. So, here we are talking about the
8 bit numbers and in this 8 bit numbers have
to talk about what is the 8 bit exponent.
So, if the exponents is 8 bit; that means,
we can go up to so; that means, we can go
up to ; that means, if I could convert it
to the decimal number you will find that we
can go up to . So, if it is a 32 bit representation
and we are going to use 8 bit for exponent
then what we are going to get we are going
to get range up to .
Now, what is the accuracy? And accuracy basically
talk about what is the changes of the value
if we are going to change the least significant
bit. So, in that particular case we are using
23 bit in our mantissa, but when we are going
to convert into binary numbers it may go we
may have that 24 bit 25th bit after decimal
point. So, but we cannot store it so; that
means, we are losing some information, but
these are the least significant bit. Ok so,
up to 23 bit we can store it, but 24 bit we
cannot store so that what is the changes of
the number if we change this particular least
significant bit and it will go from 0 to 1
or 1 to 0. So, that’s why the accuracy is
your ; that means, in decimal number it is
your ; that means, about 6 decimal places
we can have the accuracy beyond that we cannot
have the accuracy.
So, you just see that if we increase the number
of bits that range will increase as well as
accuracy will also increase. So, these are
the two issues that we are having range and
accuracy in floating point number. So, we
are having a standard call IEEE standard and
in most of the cases we use this particular
standard because we should not come up with
our own number system because globally it
should be accepted so we are having a body
call IEEE Institute of electrical and electronics
engineers is a global body and for many systems
for digital computers even for your computer
networks even for your communication they
give the standard, they freeze the standard
and after that all parties use those particular
standard.
So, for floating point representation also
that IEEE has given a format which is known
as your 754, IEEE 754 format and in that particular
format they are having two format one is your
32 bit and another one is a 64 bit because
if we are going to construct the computer
which we say that processor is a 32 bit processor;
that means, you can represent information
with the help of 32 bit. So, in that particular
case you can look for the 32 bit standard.
If your processor is your 64 bit then you
can handle 64 bit together then what will
happen when you are going to handle floating
point numbers you can look for that 34 bit
standard. And in that particular case what
is the differences in case of your 32 bit
it is your exponent is your 8 bit and in case
of your 64 bit the exponent is your 11 bit.
So, in case of range for 8 bit I am saying
that we can go up to 10^77.
Now, when we increase the exponent from 8
bit to 11 bit similarly range will also increase
now you can calculate what will be the range
that we can handle when we are going to use
32 bit format and what is the range that we
can use in your 11 bit format. Now, again
you just see that for mantissa part also now
we are increasing from 23 bit to around 54
bit it seems because 64 - 11 is your 53 - 1
is for sign bit. So, 52 we are using 52 bits
for the mantissa part or significand part;
that means, our accuracy is now going to increase
for 22 bit we are getting the up to now here
we are going to get many more. So, if we are
having more number of bits range is more accuracy
is also more.
Now, this is the format, IEEE 754 format,
this is your 32 bit format 1 bit is your sign
bit, 8 bit is for biased exponent and 23 bit
is for fraction. Similarly for your double
format this is your 64 bit. So, already I
said that fractional part is your 32 52 bit,
11 bit is your biased exponent and 1 is for
sign bit. So, I think if we have written any
program in your C language I think we are
having that one of the data type is double.
So, that means, when we are going to work
with that double data type it is a floating
point presentation and the representation
is the double format of IEEE 754 format; that
means, we are going to use 64 bit to represent
our number ok and another case we can use
32 bit to represent our number. So, this is
the format of representing floating point
number. So, we have seen how to represent
numbers basically it is either integer number
or real numbers. So, in case of real numbers
then we will use floating point representation.
There is some other code also there. So, it
is your binary code. Already we have discussed
about that excess code excess 128 or excess
127. So, this is basically depends on the
number of bits that we are using.
So, if we are using 8 bit numbers then excess
will be your excess 128 because to represent
negative number as well as positive number
what will do we store the positive number
then we subtract something from that particular
number to get the exact number.
You are having another code, code called GREY
code. So, this is just for your information
I am giving it. So, what will happen this
is a code that will have so that 2 consecutive
number is going to have a minimum signals
sense. Say as for example, if I say that this
is your 8 in binary and what is your 9, this
is 9 and what is your 10 what is your 11.
So, this is 10, this is 11 in that particular
case when I am going to get next consecutive
number you just see there is a change of bit
pattern in 3 position. Ok in some cases it
may be more also if we are going to look for
more number of bits. So, GREY code is consists
just to minimize this particular changes of
bits when you go from one number to the next
number. So, for that what basically their
GREY code is going say if this is my 0 then
next number is 1. So, basically 0 and 1 is
going to represent decimal 0 and decimal 1.
So, 00 say if I am going to have 2 bits number,
now this is representation 0 this is representation
1 then I am going to have representation 2.
So, in case of representation 2 what we are
going to do basically. So, in your binary
number system it is your 00, 01, 10 so when
I am going to from 1 to 2 there is a change
of bit position in 2 different position, but
here we want to minimize it. So, we want to
just say that there will be changes in 1 position.
Then what we are going to do we take the mirror
image of these things 1 and the most significant
bit we are going to get 1 over here because
already two 0s are there now we are going
to have this thing. So, if I take mirror image
of this thing. So, I am going to get 1 0 and
1. So, this is going to represent to this
is going to represent 3. So, this is now changing.
So, here 2 is 10 and 3 is 11 in binary number,
but in GREY code it is different.
Now, when I will go for more numbers then
what we are going to say 3 bits number then
what I am going to get, take the mirror image
of these things. That this term so, I am going
to get 10. So, this is 10. So, this 1 will
become 0 will be come 1 now. So, this is changing
only 1 position. So, this is my 4. So, this
is mirror image of 1 and 1 it is coming over
here and this bit is 1 now it will be 01 1
and this is your 001. So, this is 4 5 6 7
in decimal. So, this is the concept that we
use in our GREY code. So, basic principle
is to minimize the number of changes of bit
when we are looking for two consecutive number
you just see that if we take these 2 consecutive
numbers there is change in only 1 bit position
if you we these 2 consecutive number this
change is only bit position. If we consider
these 2 consecutive number the change of bit
position is only 1. So, this is GREY code.
In some system we may use GREY code also.
Another one is your BCD binary coded decimal.
Basically what will happen? We are accustomed
with the decimal number system now when we
convert something from decimal to binary it
is slightly taking some time or getting a
different pattern. As for example say if I
am going to have 12 then bit pattern is your
10 sorry bit pattern is 1100, 8 + 4 = 12.
But in binary coded decimal what we are going
to do digit wise we are going to convert to
the binary and for that for every digit we
are having total 10 symbol 0 to 9 and to represent
10 symbol we need at least 4 bits of information
you just see that it is your number of symbols
and number of bit pattern is related to each
other.
So, with your n bit we can go up to different
representation already have mention it. So,
with 3 bit I can go up to is 8; that means,
0 to 7. So, we are having 2 more numbers 8
and 9 for that we need 1 more bit. So, we
need 4 bit of information and this is basically
in binary coded decimal these digit if 12
these will be converted to binary or coded
to binary digit wise. So, this is 1 is going
to represent 0001 and 2 will be represented
by 0010. Like that if I am going to represent
75 in your BCD then will be your 0111 and
5 is your 0101 so 7 5. So, this is the binary
coded decimal.
So, in some system we can use these things
also and what will happen our calculation
will become easier because; that means, you
will feel that you are working the decimal
system itself.
Now, in computers we have to work with the
character also because in numbers we are doing
some arithmetic operation, but sometimes we
have to work with number system because now
you just see that in everywhere we are using
computer you are writing letters also with
the help of computer we have to say how to
represent A, how to represent B and like that.
So, here also in this representation we are
saying that character representation saying
that character c h a r a like that, but inside
computer when we are storing it we cannot
store c as it is everything has to be stored
as a binary number not only binary number
it is at the high voltage and low voltage
already I have mention these things.
So, for every character we must have to assign
some code. So, we are having several codes
to represent the character the first basic
code is your as ASCII, A S C I I American
Standard Code for Information Interchange.
So, this is a first code it is developed I
think some of you may be knowing that when
I am going to represent I think capital or
lower case then we need some number I think
to represent one of these numbers is your
65 in decimal numbers. So, for every number
we are assigning a code and we are storing
that particular code when we are going to
store information. So, EBCDIC is your extended
binary coded decimal interchange code this
is the extension of EBCDIC ASCII because what
will happen in ASCII it is basically represented
with 7 bit. So, in case of 7 bit we can go
up to 128 different character because we are
having total 128 representation from all 0s
to all 1s. So, we can go up to 128 characters.
But in case of EBCDIC, EBCDIC it is a just
extended by 1 more bit it is an 8 bit code
so; that means, my character size is increased
by 2. So, it is becoming now 256 in ASCII
it is your 128 it is your EBCDIC 256, but
if you look into the entire universe entire
globe there are a lot of symbols we should
not only think about that English alphabets
we should not think about only that numerals
and the signs like + - and like that, but
there are several languages and in every languages
they are having several character. Like if
we talk about India we can talk about the
de Devanagari script or Hindi language, so
they are having several character. Now we
have to give unique code to each and every
character.
So, this is 1 language I am talking about
in India Hindi, but we are having several
languages like that if you go to the down
south you are going to get kannadi, you are
going to get Tamil, if you come to our streets
you are going to get Assamese, you are going
to get Bengali, if you go to north then you
are going to get some Haryana, be some Marathi
language also in the west like that. So, several
languages are there and several characters
are there this is I am talking about in India,
but globally that languages is much more.
So, finally, we want to represent each and
every symbol every character to computer and
we need a bigger code with 8 bit or 7 bit
we cannot do it. So, for that the concept
of UNICODE is coming in to picture. A unique
numbers provided for each character. So, if
you want to difference some character in computer
then you have to approach this body then by
looking into the nature of the character they
will keep a unique code to this particular
symbol or particular character and that is
it can be used in computer. So, to character
representation now the standard is your UNICODE.
So, this is the different way we can represent
our information, but finally, everything will
be converted to the binary code only and computer
works on binary. So, these are the representation
issues.
Now, just see I am giving some test items
with respect to this particular representation
information representation and your carry
number system. Now the first test item I am
giving that consider a decimal number 175
write the equivalent of this number in base
2, base 5 base 8 and base 16. So, if you can
do this thing this is basically the objective
1 of this particular unit; that means, if
you can solve this thing; that means, you
can say that we have achieved the objective
1 of this particular module in it.
What are the different ways to represent integer
in computer indicate their advantages and
disadvantages. So, this is the objective 2
we are talking about the integer representation.
So, already we have discussed these issues
maybe this is your sign magnitude form one’s
complement form or two’s complement form.
The question 3, is it possible to handle integer
of any limit in a particular computer, if
not why? This is meeting objective 1 and 2,
I think already I have mentioned in my lecture
if I give you some tasks to work with pen
and paper you can go for any limit, but in
computer we are always restricted by a range.
Now why, why it is restricted by range now
you just look into it I think I have mentioned
in my lecture you just refer some books also
and see why it is restricted.
Question 4 How to represent real numbers in
computer? This is the meeting the objective
3, I think already have discussed basically
you concentrate on IEEE format because this
is a standard. How the precision of a real
number is defined? Again we have discussed
this things. So, basically number of bit pattern
that we are using in the significant of mantissa
depending on that we can say what is the precision.
Question 6 How to handle the character representation
in computer? This is the objective 4 of this
particular unit already I have mentioned in
my last slide.
So, here I can give you one more task or just
to look into it what is the size of the UNICODE
I am not mentioned over here deliberately
I have not mentioned it, now you find out
the information what is the number of bits
that we use to represent any character in
UNICODE and if there is any format is there
is you look into the format also.
Ok so, these are the test item we have slightly
looked into it and I hope that at least you
are getting idea or having idea how we are
going to represent information in computer
and how we are going to work with this particular
information. With that I wind up this particular
lecture.
Thank you all.
