ECAP268 - U01L04 - Fixed point and floating point representation

videolpuonline 13
20 Mar 202211:20

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

00:00

📚 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.

05:01

🔢 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.

10:03

👨‍🏫 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

In the context of the video, 'representation' refers to the method by which integers, including positive, negative, and zero, are encoded in a computer system. It is central to the theme as it explains how computers understand and process numbers. For instance, the script discusses different representations such as unsigned numbers for positive integers and zero, and various notations for negative integers.

💡Unsigned Numbers

Unsigned numbers are integers that do not include negative values and are represented using binary digits without any specific notation for negativity. They are integral to the video's narrative as it explains that positive integers and zero can be represented as unsigned numbers in computers, which simplifies the process of encoding these values.

💡Negative Integers

The term 'negative integers' is used to describe a subset of integers that have a minus sign in front of them. The video emphasizes the need for special notation to represent these in computers, given that hardware limitations require the use of binary digits only, hence the introduction of sign bits to indicate negativity.

💡Sign Bit

A 'sign bit' is the most significant bit in a binary number used to represent whether the number is positive or negative. The video explains the convention of using '0' for positive numbers and '1' for negative numbers in the sign bit position, which is crucial for understanding how computers encode the sign of an integer.

💡Fixed Point Representation

Fixed point representation is a method where the position of the binary point (decimal point in binary form) is set and does not change. The video discusses this concept as one of the two primary ways to represent numbers in computers, with the binary point either at the extreme left to represent fractions or at the extreme right to represent integers.

💡Floating Point Representation

Floating point representation is an alternative method to fixed point representation, where the position of the decimal point is not fixed but rather stored in a separate register. This concept is significant in the video as it allows for a more flexible representation of numbers, especially those with varying scales.

💡Mantissa

In the context of floating point representation, the 'mantissa' is the part of the number that represents the significant digits. The video explains that the mantissa is a fixed point number and is one of the two components of a floating point number, alongside the exponent.

💡Exponent

The 'exponent' in floating point representation indicates the power of 10 that the mantissa should be multiplied by to get the original number. The video uses the example of the number 6132.789, where the exponent is 4, to illustrate how the position of the decimal point is encoded in the exponent.

💡Sign-Magnitude Representation

Sign-magnitude representation is a method for encoding negative numbers where the most significant bit is used to represent the sign (0 for positive, 1 for negative), and the remaining bits represent the magnitude of the number. The video provides this as the first of three ways to represent the magnitude of negative numbers in computers.

💡One's Complement Representation

One's complement representation is a method where the negative of a number is found by inverting all the bits of its positive binary representation. The video explains this concept as the second way to represent negative numbers, using the example of the number 14, where the positive binary is inverted to represent negative 14.

💡Two's Complement Representation

Two's complement representation is a widely used method for encoding negative numbers, where the negative of a number is found by adding one to its one's complement. The video describes this as the third and final method for representing negative numbers, providing the example of how to convert the binary representation of +14 into -14 using two's complement.

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

play00:00

welcome back students students in this

play00:03

lecture we are going to study about the

play00:05

different representation of integers how

play00:08

the integers like a positive integer or

play00:11

a negative integer can be represented in

play00:14

computers okay so after this lecture you

play00:17

will be able to understand about the

play00:20

fixed point representation and the

play00:22

floating point representation of

play00:24

integers right

play00:27

so basically what is a representation

play00:29

how do we represent any integer okay

play00:33

like a positive integer is there or any

play00:35

zero is there

play00:37

both of these can be represented as

play00:39

unsigned numbers in the computers but if

play00:41

we talk about the negative integers

play00:44

we need some notation to represent these

play00:47

negative values right to pause for

play00:49

positive integers and 0 these are

play00:51

unsigned numbers as such there is no

play00:53

requirement of any other notation to

play00:56

represent these things but if we talk

play00:58

about the negative integers definitely

play01:01

we require some notation to represent

play01:03

these negative values okay so in

play01:06

ordinary mathematics a negative value a

play01:09

negative number is represented using the

play01:11

minus sign and a negative number is

play01:14

represented using the minus sign and a

play01:16

positive number is represented using a

play01:18

plus sign

play01:21

now like when we talk about computers

play01:24

because of the hardware limitations in

play01:26

it

play01:27

these positive and negative

play01:29

numbers

play01:31

are need to be represented using only

play01:33

zeros and ones only and ah these are

play01:35

need to these are represented using

play01:37

zeros and ones only the sign also

play01:41

is represented using the zero and one

play01:44

and now so as a consequence it is

play01:46

customary to represent the sign with a

play01:49

bit placed in the left most position and

play01:53

suppose i have a number say

play01:55

minus 1 3 4

play01:57

so this minus

play01:59

sign is represented with a bit placed in

play02:02

the left most position of the number

play02:05

okay the convention is to make this some

play02:08

sign

play02:09

bit

play02:10

0 for the positive and 1 for the

play02:12

negative okay 0 for the positive and 1

play02:16

for the negative

play02:19

and in addition to this sign a number

play02:21

maybe

play02:22

number may have a decimal or binary

play02:25

point also okay guys i am giving the

play02:27

convention as a decimal point or a

play02:30

binary point

play02:31

so the position of this decimal point is

play02:34

needed to represent the fractions

play02:37

integers or mixed integer fraction

play02:39

numbers okay this decimal point is

play02:42

needed to represent the fractions

play02:45

integers or mixed fraction numbers

play02:48

now there are two ways to represent

play02:51

these you know

play02:53

decimal or binary points in a register

play02:55

the first is the by giving it a fixed

play02:58

position okay by giving the fixed

play03:01

position to that decimal point the

play03:03

second one is the by employing a

play03:06

floating point representation to

play03:08

represent these decimal points or binary

play03:11

points in the number right

play03:14

so first we will talk about the first

play03:16

type that is fixed point representation

play03:19

what is this fixed point representation

play03:21

how do we represent them represent the

play03:24

numbers in that

play03:25

let's discuss about that

play03:27

this method assumes that the binary

play03:29

point is always fixed at one position

play03:32

okay so the two positions which are most

play03:34

widely used

play03:36

are the first thing is the binary point

play03:38

in the extreme left of the register to

play03:40

make the stored number a fraction okay

play03:42

this is the

play03:44

first position that is the leftmost

play03:46

position to make a number a fraction

play03:49

okay the second one is the binary point

play03:51

in the extreme right of the register to

play03:53

make the number an integer so these two

play03:56

notations are the widely used when we

play03:58

talk about the fixed point notation

play04:00

fixed point representation you can say

play04:02

where

play04:03

your

play04:04

point is fixed either in the left side

play04:07

left most side or in the right most side

play04:09

if it is in the left most side then we

play04:11

can say that the stored number as a

play04:13

fraction

play04:14

if it isn't the rightmost side that is

play04:16

an integer right

play04:19

so in either case of this either left

play04:22

most or right most the binary point is

play04:24

not present and uh the binary point is

play04:27

not present

play04:28

its presence is assumed from the fact

play04:30

that the number stored in the register

play04:33

is treated as a fraction or integer and

play04:36

now the binary point as such it is not

play04:39

present how we assume its presence by

play04:42

the

play04:42

you know

play04:44

either it is left most either it is in

play04:46

the left most bit or in the right most

play04:48

bit okay

play04:51

so when the integer binary number is

play04:52

positive the sign is represented by 0

play04:56

like we have discussed earlier also when

play04:58

the integer number is positive the sign

play05:01

will be 0 and the magnitude by a

play05:04

positive binary number so what is

play05:06

written here the when the binary when

play05:08

the integer binary number is positive

play05:10

the sign is represented by the 0 and its

play05:13

magnitude by a positive binary number

play05:17

so when the number is negative the sign

play05:19

is represented by 1

play05:21

remember this thing guys for positive it

play05:24

is 0 and for negative it is 1 when the

play05:26

number is positive the sign is

play05:28

represented by the 0 and magnitude is

play05:30

represented by a positive number but if

play05:33

we have a number as a negative number so

play05:36

the sign is represented by one and there

play05:39

are three ways by which we can represent

play05:41

the uh the magnitude of that number that

play05:45

negative number what are these three

play05:47

ways the first way is the sign magnitude

play05:49

representation okay this is the first

play05:52

way that is signed magnitude

play05:54

representation the second one is signed

play05:57

one's complement representation third

play05:59

one is signed two's complement

play06:02

representation there are three ways by

play06:04

which we can represent the

play06:07

magnitude of a

play06:09

negative number okay we will discuss all

play06:12

of these three in uh one by one okay

play06:16

so let us take one example if i want to

play06:18

represent the sign number 14 the so like

play06:22

i have given you the sign number 14 it

play06:25

can be plus 14 as well it can be minus

play06:27

14 as well and now so if i talk about

play06:31

the plus 14

play06:32

how can we represent that first of all

play06:35

it is plus so definitely zero will be

play06:37

used for representation of sign and then

play06:39

we have to give the number

play06:41

okay so plus 14 is represented by a sine

play06:44

bit of 0 in the left most position

play06:47

followed by its binary equivalent of 14

play06:50

like 0 0 0 0 1 1 1 0 this is the binary

play06:54

representation of plus 14. okay this is

play06:57

just only one way to represent the

play06:59

positive sign numbers but if we talk

play07:02

about the negative number that is minus

play07:04

14 what are the different ways the first

play07:07

way is the signed magnitude

play07:09

representation definitely if it is you

play07:12

know minus 14 so one will be used to

play07:15

represent the minus sign so how can we

play07:17

represent that 1

play07:19

triple 0 triple 1 0 this is the first

play07:22

way to represent minus 14 that is the

play07:25

signed magnitude representation

play07:28

okay earlier it was plus 14 so it was 4

play07:32

times 0 triple 1 and 0.

play07:34

now we are using the sine magnitude so

play07:37

definitely one will be used for

play07:38

representation of negative and

play07:41

triple 0 triple 1 and 0 okay this is the

play07:44

first way now the second way what is the

play07:47

second way signed one's complementary

play07:49

presentation

play07:51

we are supposed to take the complement

play07:54

of that and uh earlier it was what it

play07:56

was 0 0 0 0 1 1 1 and 0 this is plus 14

play08:02

we are supposed to take the ones

play08:04

complement of that

play08:05

okay so it is 1 1 1 1

play08:09

triple 0 and 1 means 4 times 1 triple 0

play08:12

and 1 okay we are going to take the 1's

play08:15

complement of that plus 14. that makes

play08:18

up minus 14.

play08:20

next representation that is last

play08:22

representation we have is the signed

play08:24

two's complement representation

play08:26

how can we find out signed two's

play08:28

complement here guys two's complement

play08:30

can be find out by adding one to the

play08:33

ones complement so our ones complement

play08:35

is four times one triple zero one if we

play08:38

add one to that that gives you

play08:40

4 times 1 0 0 1 0. these are the three

play08:44

ways by which we can represent our

play08:46

negative numbers in the computers okay

play08:49

because of the hardware limitations we

play08:51

cannot put plus or minus in the front of

play08:54

a number so these are the ways by which

play08:56

we can represent okay

play08:59

so next representation where is the

play09:02

floating point representation till now

play09:04

we have discussed about the fixed point

play09:07

representation where the point is fixed

play09:10

okay next is the floating point

play09:12

representation so here in this method it

play09:15

uses a second register to store a number

play09:18

that designates the position of the

play09:20

decimal point in the first register so

play09:23

what are these things

play09:24

okay

play09:26

in one register you have a number in

play09:28

second register

play09:30

the place where you have the decimal in

play09:32

your number it stores that value okay so

play09:35

it uses two registers to store that

play09:37

number right

play09:39

so the floating point representation has

play09:41

two parts the first part contains

play09:44

assigned a fixed point number that is

play09:47

called mantissa you must have heard

play09:49

about the mantissa and exponents here we

play09:51

are going to discuss about that thing

play09:53

only okay the first part contains

play09:56

assigned a fixed point number which is

play09:58

known as mantissa the second part

play10:00

contains the position of the decimal

play10:02

point which is known as exponent okay a

play10:06

floating point number has these two

play10:07

things only a mantissa and exponent

play10:11

so the fixed point mantissa may be a

play10:13

fraction or an integer

play10:16

let us take one example um the number is

play10:19

plus 6132

play10:22

0.789

play10:24

how can we represent this particular

play10:26

number using the floating point

play10:28

representation how can we represent so

play10:30

the fraction here is

play10:32

plus 0.6132789

play10:37

in the second register we will save its

play10:39

exponent the exponent is plus 0 4 how it

play10:43

is plus 0 because it is at plus fourth

play10:46

position in the number okay that is why

play10:50

the exponent is plus four so these two

play10:53

things are we are going to store in the

play10:55

register

play10:56

okay so the value of

play10:58

exponent indicates here that the actual

play11:01

position of the decimal point on in the

play11:03

number this can also be represented as

play11:06

0.6132789

play11:09

into 10 raised to power 4.

play11:12

okay we can represent this number as

play11:14

well

play11:14

like this as well right

play11:17

that's all for now guys thank you so

play11:19

much

Rate This

5.0 / 5 (0 votes)

Related Tags
Integer RepresentationComputer ScienceFixed PointFloating PointBinary NumbersMantissaExponentNumber SystemsDigital MathEducationalTechnical Tutorial