ECAP268 - U01L04 - Fixed point and floating point representation
Summary
TLDRThis lecture delves into the representation of integers in computers, focusing on fixed and floating point representations. It explains how positive and negative integers are encoded using bits, with the sign bit determining the value's positivity or negativity. The video introduces three methods for representing negative numbers: sign magnitude, one's complement, and two's complement. It also covers the concept of mantissa and exponent in floating point representation, demonstrating how to encode numbers like 6132.789 as a combination of a fixed point number and an exponent.
Takeaways
- 🖥️ Computers represent integers using binary numbers, with different methods for positive and negative values.
- 🔢 Positive integers and zero are represented as unsigned numbers, while negative integers require a notation to denote their sign.
- 🔣 In computer systems, the sign of an integer is represented by a bit in the leftmost position, with '0' for positive and '1' for negative.
- 📍 The position of the decimal or binary point is crucial for representing fractions, integers, or mixed numbers in computers.
- 🔁 There are two main types of fixed point representation: one with the binary point fixed at the leftmost position (fraction) and the other at the rightmost position (integer).
- 🔑 The sign of a positive integer is represented by a '0', and its magnitude by a positive binary number.
- 📌 Negative integers can be represented in three ways: sign-magnitude, one's complement, and two's complement.
- 🔄 In sign-magnitude representation, the sign is indicated by '1' for negative, followed by the binary representation of the number.
- 🔄 One's complement representation is found by taking the complement of the binary number representing the positive value.
- 🔄 Two's complement representation is obtained by adding one to the one's complement of the positive number.
- 🔄 Floating point representation uses two registers: one for the mantissa (fixed point number) and another for the exponent (position of the decimal point).
Q & A
What are the two main types of integer representation discussed in the lecture?
-The two main types of integer representation discussed are fixed point representation and floating point representation.
How are positive integers and zero represented in computers?
-Positive integers and zero are represented as unsigned numbers in computers, using only zeros and ones without any additional notation.
Outlines
📚 Introduction to Integer Representation in Computers
This paragraph introduces the topic of how integers, including positive, negative, and zero, are represented in computers. It explains that unsigned numbers can represent positive integers and zero, while a separate notation is needed for negative integers. The hardware limitations of computers require that signs be represented using bits, with the most significant bit typically indicating the sign (0 for positive, 1 for negative). The paragraph also touches on the representation of decimal or binary points in fixed and floating point representations, setting the stage for a deeper dive into these concepts.
🔢 Fixed Point and Floating Point Representations Explained
This paragraph delves into the specifics of fixed point representation, where the binary point's position is fixed, either at the leftmost or rightmost position of the register, to indicate whether the number is a fraction or an integer. It also introduces the concept of floating point representation, where a second register is used to store the position of the decimal point, allowing for more flexibility in representing numbers. The paragraph outlines the two main components of floating point numbers: the mantissa, a fixed point number, and the exponent, which indicates the decimal point's position.
👨🏫 Methods of Representing Negative Numbers in Computers
The third paragraph focuses on the different methods used to represent negative numbers in computers due to hardware limitations that prevent the use of plus or minus signs. It discusses three primary methods: sign-magnitude representation, where the most significant bit indicates the sign and the rest represent the magnitude; one's complement representation, which involves taking the complement of the positive number; and two's complement representation, where one is added to the one's complement of the positive number. The paragraph provides examples of how to represent the number 14 in both positive and negative forms using these methods.
Mindmap
Keywords
💡Representation
💡Unsigned Numbers
💡Negative Integers
💡Sign Bit
💡Fixed Point Representation
💡Floating Point Representation
💡Mantissa
💡Exponent
💡Sign-Magnitude Representation
💡One's Complement Representation
💡Two's Complement Representation
Highlights
Lecture focuses on different representations of integers in computers.
Fixed point and floating point representations are discussed for integer representation.
Positive integers and zero can be represented as unsigned numbers.
Negative integers require a notation for representation.
Computers represent positive and negative numbers using only zeros and ones.
Sign bit is placed in the leftmost position to indicate the sign of the number.
Decimal or binary point is needed to represent fractions or mixed numbers.
Fixed point representation assumes a fixed position for the binary point.
Two common fixed point positions are the leftmost for fractions and rightmost for integers.
Sign magnitude, signed one's complement, and signed two's complement are methods for negative number representation.
Sign magnitude representation uses 0 for positive and 1 for negative signs.
Signed one's complement representation involves taking the complement of the positive number.
Signed two's complement is found by adding one to the one's complement.
Floating point representation uses two registers: one for mantissa and another for exponent.
Mantissa is a fixed point number, and exponent indicates the position of the decimal point.
Floating point representation allows for the storage of large and small numbers efficiently.
Example given for representing the number 6132.0789 using floating point representation.
The lecture concludes with a summary of the discussed representations and their applications.
Transcripts
welcome back students students in this
lecture we are going to study about the
different representation of integers how
the integers like a positive integer or
a negative integer can be represented in
computers okay so after this lecture you
will be able to understand about the
fixed point representation and the
floating point representation of
integers right
so basically what is a representation
how do we represent any integer okay
like a positive integer is there or any
zero is there
both of these can be represented as
unsigned numbers in the computers but if
we talk about the negative integers
we need some notation to represent these
negative values right to pause for
positive integers and 0 these are
unsigned numbers as such there is no
requirement of any other notation to
represent these things but if we talk
about the negative integers definitely
we require some notation to represent
these negative values okay so in
ordinary mathematics a negative value a
negative number is represented using the
minus sign and a negative number is
represented using the minus sign and a
positive number is represented using a
plus sign
now like when we talk about computers
because of the hardware limitations in
it
these positive and negative
numbers
are need to be represented using only
zeros and ones only and ah these are
need to these are represented using
zeros and ones only the sign also
is represented using the zero and one
and now so as a consequence it is
customary to represent the sign with a
bit placed in the left most position and
suppose i have a number say
minus 1 3 4
so this minus
sign is represented with a bit placed in
the left most position of the number
okay the convention is to make this some
sign
bit
0 for the positive and 1 for the
negative okay 0 for the positive and 1
for the negative
and in addition to this sign a number
maybe
number may have a decimal or binary
point also okay guys i am giving the
convention as a decimal point or a
binary point
so the position of this decimal point is
needed to represent the fractions
integers or mixed integer fraction
numbers okay this decimal point is
needed to represent the fractions
integers or mixed fraction numbers
now there are two ways to represent
these you know
decimal or binary points in a register
the first is the by giving it a fixed
position okay by giving the fixed
position to that decimal point the
second one is the by employing a
floating point representation to
represent these decimal points or binary
points in the number right
so first we will talk about the first
type that is fixed point representation
what is this fixed point representation
how do we represent them represent the
numbers in that
let's discuss about that
this method assumes that the binary
point is always fixed at one position
okay so the two positions which are most
widely used
are the first thing is the binary point
in the extreme left of the register to
make the stored number a fraction okay
this is the
first position that is the leftmost
position to make a number a fraction
okay the second one is the binary point
in the extreme right of the register to
make the number an integer so these two
notations are the widely used when we
talk about the fixed point notation
fixed point representation you can say
where
your
point is fixed either in the left side
left most side or in the right most side
if it is in the left most side then we
can say that the stored number as a
fraction
if it isn't the rightmost side that is
an integer right
so in either case of this either left
most or right most the binary point is
not present and uh the binary point is
not present
its presence is assumed from the fact
that the number stored in the register
is treated as a fraction or integer and
now the binary point as such it is not
present how we assume its presence by
the
you know
either it is left most either it is in
the left most bit or in the right most
bit okay
so when the integer binary number is
positive the sign is represented by 0
like we have discussed earlier also when
the integer number is positive the sign
will be 0 and the magnitude by a
positive binary number so what is
written here the when the binary when
the integer binary number is positive
the sign is represented by the 0 and its
magnitude by a positive binary number
so when the number is negative the sign
is represented by 1
remember this thing guys for positive it
is 0 and for negative it is 1 when the
number is positive the sign is
represented by the 0 and magnitude is
represented by a positive number but if
we have a number as a negative number so
the sign is represented by one and there
are three ways by which we can represent
the uh the magnitude of that number that
negative number what are these three
ways the first way is the sign magnitude
representation okay this is the first
way that is signed magnitude
representation the second one is signed
one's complement representation third
one is signed two's complement
representation there are three ways by
which we can represent the
magnitude of a
negative number okay we will discuss all
of these three in uh one by one okay
so let us take one example if i want to
represent the sign number 14 the so like
i have given you the sign number 14 it
can be plus 14 as well it can be minus
14 as well and now so if i talk about
the plus 14
how can we represent that first of all
it is plus so definitely zero will be
used for representation of sign and then
we have to give the number
okay so plus 14 is represented by a sine
bit of 0 in the left most position
followed by its binary equivalent of 14
like 0 0 0 0 1 1 1 0 this is the binary
representation of plus 14. okay this is
just only one way to represent the
positive sign numbers but if we talk
about the negative number that is minus
14 what are the different ways the first
way is the signed magnitude
representation definitely if it is you
know minus 14 so one will be used to
represent the minus sign so how can we
represent that 1
triple 0 triple 1 0 this is the first
way to represent minus 14 that is the
signed magnitude representation
okay earlier it was plus 14 so it was 4
times 0 triple 1 and 0.
now we are using the sine magnitude so
definitely one will be used for
representation of negative and
triple 0 triple 1 and 0 okay this is the
first way now the second way what is the
second way signed one's complementary
presentation
we are supposed to take the complement
of that and uh earlier it was what it
was 0 0 0 0 1 1 1 and 0 this is plus 14
we are supposed to take the ones
complement of that
okay so it is 1 1 1 1
triple 0 and 1 means 4 times 1 triple 0
and 1 okay we are going to take the 1's
complement of that plus 14. that makes
up minus 14.
next representation that is last
representation we have is the signed
two's complement representation
how can we find out signed two's
complement here guys two's complement
can be find out by adding one to the
ones complement so our ones complement
is four times one triple zero one if we
add one to that that gives you
4 times 1 0 0 1 0. these are the three
ways by which we can represent our
negative numbers in the computers okay
because of the hardware limitations we
cannot put plus or minus in the front of
a number so these are the ways by which
we can represent okay
so next representation where is the
floating point representation till now
we have discussed about the fixed point
representation where the point is fixed
okay next is the floating point
representation so here in this method it
uses a second register to store a number
that designates the position of the
decimal point in the first register so
what are these things
okay
in one register you have a number in
second register
the place where you have the decimal in
your number it stores that value okay so
it uses two registers to store that
number right
so the floating point representation has
two parts the first part contains
assigned a fixed point number that is
called mantissa you must have heard
about the mantissa and exponents here we
are going to discuss about that thing
only okay the first part contains
assigned a fixed point number which is
known as mantissa the second part
contains the position of the decimal
point which is known as exponent okay a
floating point number has these two
things only a mantissa and exponent
so the fixed point mantissa may be a
fraction or an integer
let us take one example um the number is
plus 6132
0.789
how can we represent this particular
number using the floating point
representation how can we represent so
the fraction here is
plus 0.6132789
in the second register we will save its
exponent the exponent is plus 0 4 how it
is plus 0 because it is at plus fourth
position in the number okay that is why
the exponent is plus four so these two
things are we are going to store in the
register
okay so the value of
exponent indicates here that the actual
position of the decimal point on in the
number this can also be represented as
0.6132789
into 10 raised to power 4.
okay we can represent this number as
well
like this as well right
that's all for now guys thank you so
much
5.0 / 5 (0 votes)