Floating Point Numbers | Fixed Point Number vs Floating Point Numbers

ALL ABOUT ELECTRONICS
25 Nov 202313:39

Summary

TLDRThis video from the ALL ABOUT ELECTRONICS YouTube channel explores floating point numbers, crucial for representing both very large and very small values in digital systems. It contrasts fixed point numbers, where the radix point is static, limiting the range of representable numbers, with floating point numbers that dynamically adjust the radix point for broader range and precision. The script explains the scientific notation-like representation of floating points, including the significand and exponent, and hints at the IEEE 754 standard used for storage, promising a deeper dive in the next video.

Takeaways

  • 🌐 In digital systems, floating-point numbers allow for the representation of both very large and very small numbers, which fixed-point numbers struggle with.
  • 🔢 Fixed-point numbers have a radix or decimal point with a fixed position, limiting the range of numbers that can be represented with a given number of bits.
  • 📉 The range of numbers in fixed-point representation is constrained, and increasing the number of bits can extend this range but at the cost of precision.
  • 🔄 The position of the radix point in fixed-point numbers is static, which contrasts with floating-point numbers where it can be dynamically adjusted.
  • 🔬 Floating-point numbers are similar to scientific notation, where the radix point is normalized to have one significant digit before it, allowing for a uniform representation.
  • 💡 The floating-point representation consists of three parts: sign, fraction (mantissa), and exponent, with the base of the exponent being 2, unlike scientific notation which uses base 10.
  • 📚 The IEEE 754 standard defines how floating-point numbers are stored in memory, including the allocation of bits for the sign, exponent, and mantissa.
  • 🛠️ To represent a number in floating-point format, the binary point must be normalized so that the most significant digit before the point is 1.
  • 🔑 The sign bit is the most significant bit (MSB) in floating-point storage, determining whether the number is positive or negative.
  • 💻 The mantissa, or fractional part of the significand, is stored without the leading '1' that is implicit in normalized floating-point numbers.

Q & A

  • What are floating point numbers?

    -Floating point numbers are a way to represent real numbers in computers, allowing for a variable number of digits both before and after the decimal point. They are particularly useful for representing very large or very small numbers with precision.

  • How do floating point numbers differ from fixed point numbers?

    -Fixed point numbers have a fixed radix or decimal point, which means the range and precision are limited by the number of bits allocated for the integer and fractional parts. Floating point numbers, on the other hand, allow the radix point to move, providing a dynamic range and precision.

  • Why are floating point numbers important in digital systems?

    -Floating point numbers are important in digital systems because they enable the representation of a wide range of values, from very large to very small, with a high degree of precision. This is crucial for scientific calculations, engineering, and any application that requires accurate real number representation.

  • What is the significance of the scientific notation in the context of floating point numbers?

    -In the context of floating point numbers, scientific notation is used to normalize numbers so that there is only one significant digit before the radix point. This normalization allows for a uniform representation of numbers, making it easier to store and process them in computers.

  • How is the range of numbers represented in a fixed point system limited?

    -The range of numbers in a fixed point system is limited by the number of bits allocated for the integer and fractional parts. More bits for the integer part increase the range but decrease precision, and vice versa for the fractional part.

  • What is the IEEE 754 standard and why is it used?

    -The IEEE 754 standard is a widely adopted format for representing floating point numbers in computers. It defines the way in which the sign, exponent, and significand (mantissa) are stored, ensuring consistency across different systems and processors.

  • How many significant digits are allowed before the decimal point in scientific notation?

    -In scientific notation, there should be only one significant digit before the decimal point. This is part of the normalization process that allows for a uniform representation of numbers.

  • What part of the floating point number is not stored explicitly?

    -In floating point representation, the integer part of the significand (which is always 1 in normalized numbers) is not stored explicitly. Only the fractional part, also known as the mantissa, is stored.

  • How does the position of the radix point affect the exponent in floating point numbers?

    -In floating point numbers, shifting the radix point to the left increases the exponent, and shifting it to the right decreases the exponent. This dynamic adjustment allows for representing numbers with varying ranges and precisions.

  • What are the three parts of a floating point number when stored in memory?

    -When stored in memory, a floating point number consists of three parts: the sign bit, which indicates the number's sign; the exponent, which determines the position of the radix point; and the mantissa (significand), which represents the fractional part of the number.

Outlines

00:00

🔢 Introduction to Fixed and Floating Point Numbers

This paragraph introduces the topic of floating point numbers and their importance in digital systems for representing both very large and very small numbers. It contrasts fixed point numbers, where the position of the radix point is fixed, with floating point numbers, which allow for dynamic adjustment of the radix point's position. The paragraph explains that in fixed point representation, the range of representable numbers is limited by the number of bits allocated for the integer and fractional parts, and increasing the number of bits can increase this range but at the cost of precision. The limitations of fixed point numbers are highlighted, particularly when trying to represent numbers with a wide range of magnitudes.

05:04

📉 The Limitations of Fixed Point Representation

The second paragraph delves into the specific limitations of fixed point representation, using examples to illustrate how a fixed radix point restricts the range and precision of numbers that can be represented. It explains that increasing the number of bits allocated to the fractional part can improve precision but reduces the range of representable numbers. The paragraph transitions into an introduction of floating point representation, which allows for dynamic adjustment of the radix point to balance range and precision. It also introduces the concept of scientific notation as a basis for floating point representation, highlighting the use of significand and exponent to normalize numbers for uniform representation.

10:05

🔄 Floating Point Representation and Normalization

The final paragraph explains the process of normalizing binary numbers for floating point representation, where the binary point is shifted to ensure that the significant digit just before the point is 1. It discusses how the exponent is adjusted based on the shifting of the radix point, with leftward shifts increasing the exponent and rightward shifts decreasing it. The paragraph concludes with a brief mention of how floating point numbers are stored in memory, with separate sections for the sign bit, exponent, and mantissa (fractional part). It also introduces the IEEE 754 standard, which will be further explored in a subsequent video, and summarizes the advantages of floating point representation for handling a wide range of numbers with precision.

Mindmap

Keywords

💡Floating Point Numbers

Floating point numbers are a way of representing real numbers in computers. Unlike fixed-point numbers, where the decimal point's position is fixed, floating point numbers allow the decimal point to 'float', which means it can be moved to different positions relative to the significant digits. This flexibility enables computers to represent a wide range of values, from very large to very small, with a reasonable amount of precision. In the video, floating point numbers are discussed as a method to store numbers like the mass of planets or the Planck's constant, which are either very large or very small.

💡Fixed Point Numbers

Fixed point numbers are a representation of numbers where the radix point (decimal point) is fixed relative to the binary digits. This means that the position of the decimal point does not change, and the range of numbers that can be represented is limited by the number of bits allocated for the integer and fractional parts. The video explains that fixed point numbers are less flexible than floating point numbers because they cannot dynamically adjust the range and precision of the numbers they represent.

💡Radix Point

The radix point, also known as the decimal point, is the symbol used to separate the integer part from the fractional part of a number. In the context of the video, the position of the radix point is fixed in fixed point numbers, which limits the range of numbers that can be represented. In contrast, in floating point numbers, the radix point can be moved, allowing for a dynamic range and precision.

💡Scientific Notation

Scientific notation is a way of expressing numbers that are too large or too small to be conveniently written in decimal form. It is typically written as the product of a number between 1 and 10 and a power of 10. The video uses scientific notation as an analogy to explain how floating point numbers are represented in computers, where the significand (the equivalent of the number between 1 and 10) and the exponent (the power of 10) are used to represent the number.

💡Significand

The significand, also known as the mantissa, is the part of a floating point number that represents the significant digits of the number. In the video, it is explained that in floating point representation, the integer part of the significand is always 1 and is not stored, only the fractional part is stored. This is because the binary point is normalized to precede a single '1', which is the most significant bit.

💡Exponent

In the context of floating point numbers, the exponent is the power to which the base (usually 2 in binary systems) is raised to scale the significand. The video explains that the exponent can be positive or negative, and it determines the range of the number. The exponent is stored as part of the floating point number, allowing the computer to represent numbers over a wide range.

💡Normalization

Normalization in floating point representation refers to the process of adjusting the position of the binary point so that there is only one significant digit (1 in binary) before the binary point. This process ensures that all floating point numbers are represented in a uniform way, which simplifies arithmetic operations and comparison. The video demonstrates how normalization is used to convert a binary number into a floating point format.

💡IEEE 754

The IEEE 754 standard is a widely used format for representing floating point numbers in computers. It defines how many bits are used for the sign, exponent, and significand, as well as the rules for rounding and handling special cases like infinity and NaN (Not a Number). The video mentions that the next video will delve into the specifics of the IEEE 754 standard and how it facilitates the storage of floating point numbers.

💡Mantissa

The mantissa is another term for the significand in floating point representation. It refers to the fractional part of the number that follows the most significant digit, which is always 1 in normalized floating point numbers. The video explains that the mantissa is stored in the computer memory as part of the floating point number, along with the sign and exponent.

💡Precision

Precision in the context of floating point numbers refers to the number of digits accurately represented in a number. The video discusses the trade-off between precision and range in fixed point numbers, where increasing the precision for fractional parts reduces the range of integer values that can be represented. Floating point numbers, on the other hand, can offer both a wide range and a high precision by dynamically adjusting the position of the radix point.

Highlights

Introduction to floating point numbers and their importance in representing very large or very small numbers in computers.

Explanation of fixed point numbers and their limitations in range due to fixed radix point.

Comparison between integers and real numbers in fixed point representation.

The issue with fixed point numbers in digital systems due to limited range and precision with a fixed number of bits.

How the position of the radix point affects the range and precision in fixed point numbers.

The concept of scientific notation and its similarity to floating point representation.

The significance of normalization in floating point numbers to ensure one significant digit before the radix point.

The structure of floating point numbers consisting of sign, fraction, and exponent parts.

The dynamic nature of floating point representation allowing for variable radix point location.

How floating point numbers provide both a good range and precision for representing numbers.

The process of normalizing binary numbers for floating point representation.

The three-part storage of floating point numbers: sign, exponent, and mantissa.

Introduction to the IEEE 754 standard for floating point number storage.

The role of the sign bit in determining the positivity or negativity of a floating point number.

The division of bits for storing the exponent and mantissa in a floating point number.

The upcoming discussion on IEEE 754 format in the next video.

Invitation for questions, suggestions, and engagement from the audience.

Transcripts

play00:06

Hey friends, welcome to the YouTube channel ALL ABOUT ELECTRONICS.

play00:10

So in this video, we will learn about the floating point numbers.

play00:14

And we will see that how very large numbers like the mass of the planets or the Avogadro's

play00:20

number and similarly very small numbers like the mass of the atom or the Planck's constant

play00:26

is stored in the computers.

play00:28

So, during the video, we will also see the difference between the fixed point number

play00:32

and the floating point numbers.

play00:34

And with this comparison, we will understand the importance of the floating point numbers

play00:38

in the digital systems.

play00:40

So first, let us understand what is the fixed point numbers.

play00:45

So in our day-to-day life, we are all dealing with the integers as well as the real numbers.

play00:51

Now when these numbers are represented in the fixed point representation, then the position

play00:55

of the radix point or the decimal point remains the fixed.

play00:59

So all the integers are the example of the fixed point numbers.

play01:03

So for the integers, there is no fractional part or in other words, the fractional part

play01:08

is equal to zero.

play01:10

So by default, the position of the decimal point is at the end of the least significant

play01:15

digit.

play01:16

Hence, there is no fractional part, so typically, we do not represent this decimal point.

play01:22

But we can say that there is a decimal point on the right-hand side of this least significant

play01:27

digit.

play01:29

And this position of this decimal point will also remain fixed.

play01:33

So similarly, for the real numbers, the position of the decimal point is just before the fractional

play01:38

part.

play01:39

For example, this 11.75 is the real number, where 11 is the integer part and 75 just after

play01:48

this decimal point represents the fractional part.

play01:51

So when these real numbers are represented in the fixed point representation, then the

play01:55

position of this decimal point remains the fixed.

play01:58

Now in any digital system, these numbers are stored in a binary format using the certain

play02:03

number of bits.

play02:04

Let's say in a one digital system, these numbers are stored in a 10-bit format.

play02:10

Now the issue with the fixed point representation is that with the given number of bits, the

play02:14

range of the numbers that we can represent is very less.

play02:18

So if we take the case of the integers, and specifically, an unsigned integer, then in

play02:24

the 10-bit format, we can represent any number between 0 and 1023.

play02:29

On the other hand, for the signed integers, the MSB is reserved for the signed bit.

play02:35

So using the 10 bits, we can represent any number between -512 to +511.

play02:41

That means using the 10 bits, the range of the numbers that we can represent is very

play02:46

limited.

play02:47

So here, basically the range refers to the difference between the smallest and the largest

play02:52

number.

play02:53

So of course, by increasing the number of bits, we can increase this range.

play02:58

But still, if we want to represent the very large numbers, like 10^24 or 10^25, for example

play03:05

the mass of the earth, then we need more than 80 bits.

play03:10

And the issue of the range becomes even more prominent with the real numbers.

play03:14

So when we are dealing with the real numbers, then we always come across this decimal point

play03:19

or in general this radix point.

play03:22

So the digits on the left of this decimal point represents the integer part and the

play03:26

digits on the right represents the fractional part.

play03:29

So to store such numbers in a binary format in the computers, some bits are reserved for

play03:34

the integer part and the some bits are reserved for the fractional part.

play03:39

So let's say, once again, these real numbers are stored in a 10-bit format.

play03:44

And out of the 10-bit, the 6 bits are reserved for the integer part and the 4 bits are reserved

play03:48

for the fractional part.

play03:50

Now when we store these numbers in a binary format, then there is no provision for storing

play03:55

this binary point explicitly.

play03:57

But here, we have different sections for the integer as well as the fractional part.

play04:02

And accordingly, each bit will have its place value.

play04:06

So here, just after the 2^0s place, we will assume that there is a binary point.

play04:12

So out of the 10 bits, if we reserve 6 bits for the integer part, then for the unsigned

play04:17

numbers, we can represent any number between 0 to 63.

play04:22

And for the fractional part, the maximum number that we can represent is equal to 0.9375.

play04:29

And the minimum number will be equal to 0.0625.

play04:34

That means in the 10-bit format, if we want to represent any real number, then the minimum

play04:38

non-zero number that we can represent is equal to 0.0625, while if we see the maximum

play04:44

number, then that is equal to 63.9375.

play04:49

That means in general, in this fixed-point representation, the location of the radix

play04:53

point is fixed.

play04:55

And once we decide it, then it will not change.

play04:58

So in a 10-bit fixed-point representation, once we freeze this specific format, like

play05:03

the 6 bits for the integer and the 4 bits for the fraction, then we cannot represent

play05:08

any number smaller than this 0.0625.

play05:12

For example, if we want to represent this 22.0125 or this 35.0025, then we cannot represent

play05:20

it in this 10-bit fixed-point representation.

play05:23

So if we want to represent such smaller numbers, then we need to assign more bits for this

play05:28

fractional part, like the 5-bit or the 6 bits for the fractional part.

play05:33

So, of course, by doing so, certainly we can increase the precision.

play05:38

But now, our range will get compromised.

play05:41

For example, now we have only 4 bits for the integer part.

play05:46

And now, in these 4 bits, we can represent any number between 0 to 15.

play05:52

That means in this fixed-point representation, once the location of this radix point is fixed,

play05:57

then our range and the precision will also get fixed.

play06:01

But in the floating-point representation, it is possible to change the location of

play06:05

this radix point or the binary point dynamically.

play06:08

For example, for the given number of bits, let's say a 10-bit, if we want more range,

play06:13

then we can shift this binary point towards the right.

play06:17

Or for example, for some application, if we require more precision, then it is possible

play06:23

to shift the radix point towards the left.

play06:26

That means using the floating-point representation, it is possible to represent the very large

play06:30

numbers like the distance between the planets or the mass of the planets and the very small

play06:35

number like the mass of the atom using these floating-point numbers.

play06:40

So this floating-point representation provides both good range as well as the precision.

play06:46

So now, let's see how to represent these floating-point numbers.

play06:51

So the representation of this floating-point number is very similar to how we are representing

play06:55

the decimal numbers in the scientific notation.

play06:58

So in the scientific notation, the radix point or the decimal point is set in such

play07:03

a way that we have only one significant digit before the decimal point.

play07:08

So for the integers, by default, the radix point or this decimal point is set to the

play07:13

right-hand side of this least significant digit.

play07:17

So here, to represent this number in the scientific notation, the decimal point is shifted to

play07:22

the left-hand side by the five decimal places.

play07:25

And that is why, here the exponent is equal to 5.

play07:29

So as you can see over here, we have only one significant digit before the decimal point.

play07:34

But if the same number is represented like this, then that is not the scientific notation.

play07:40

Because if you see over here, then the digit before the decimal point is 0.

play07:45

But in the scientific notation, it has to be non-zero.

play07:48

Similarly, if you take this number, then in the scientific notation, this is how it can

play07:54

be represented.

play07:56

So here, for the scientific notation, the decimal point is shifted to the right by three

play08:01

decimal places.

play08:03

And that is why over here, in the exponential term, we have this 10 to the power minus 3.

play08:08

So in the scientific notation, we have total two components.

play08:12

That is the significand and the exponent.

play08:15

So here, in the second representation, if you see the significand, then that is equal

play08:20

to 4.345.

play08:22

And similarly, the exponent is equal to minus 3.

play08:26

And here of course, since we are representing the decimal numbers, so the base of the exponent

play08:31

is equal to 10.

play08:33

So here in the scientific notation, we are normalizing the numbers so that we have only

play08:38

one significant digit before the decimal point.

play08:41

And because of this normalization, it is possible to represent all the numbers in a uniform

play08:46

fashion.

play08:47

For example, if we take the case of this number, then the same number can also be represented

play08:53

like this.

play08:55

And of course, the value of the number will still remain the same.

play08:58

But as you can see, all these representations are different.

play09:02

So that is why it is good to have a uniform representation for each number.

play09:07

So in general, we can say that in a scientific notation, this is how the decimal number is

play09:12

represented, where this D represents the decimal digit.

play09:16

So similarly, this floating point representation is very similar.

play09:21

And here, this B represents the binary digits.

play09:24

So if you see this floating point representation, then it consists of the three parts.

play09:29

That is sign, fraction, and the exponent part.

play09:33

And here, the base of the exponent is equal to 2.

play09:37

So in this representation also, first binary numbers are normalized in this format.

play09:43

So in a scientific notation, we have seen that we must have only one significant digit

play09:47

before the decimal point.

play09:49

Now in the case of the binary, we have only two digits, that is 1 and 0.

play09:55

And therefore in the binary, the only possible significant digit is equal to 1.

play10:00

That means in this floating point representation, this significant digit just before the binary

play10:04

point will always remain 1.

play10:07

So we can say that, this is the general representation for the floating point number.

play10:12

So now let's see, how to normalize any binary number and how to represent it in the floating

play10:17

point representation.

play10:20

So let's say, this is our binary number.

play10:23

And we want to represent this number in the normalized form.

play10:26

So for that, we need to shift this binary point in such a way that just before the binary

play10:31

point, the significant digit is equal to 1.

play10:35

That means here, we need to shift the binary point to the left by 2 bits.

play10:40

And that is why over here, this exponent is equal to 2.

play10:44

That means whenever we shift the radix point to the left by a 1-bit position, then the

play10:48

exponent will increase by 1.

play10:50

So here, since the radix point is shifted to the left side by 2 bits, so the exponent

play10:55

will increase by 2.

play10:57

So similar to the left-hand side, when the radix point is shifted to the right by a 1-bit

play11:02

position, then the exponent will decrease by 1.

play11:05

For example, if we have this number and to represent this number in a normalized form,

play11:11

we need to shift the binary point to the right side by 2 bits.

play11:15

And that is why here the exponent will decrease by 2.

play11:18

Or in other words, here this exponent is equal to minus 2.

play11:22

So these two representations are in the normalized form.

play11:26

So in this way, we can normalize any binary number and we can represent it in the floating

play11:31

point form.

play11:33

So now, let's see how this floating point number is actually stored in the memory.

play11:38

So while storing, the 1-bit is reserved for the sign bit.

play11:42

That means while this number is stored, then the MSB will represent the sign bit.

play11:47

So if this bit is 0, then it means that the number is positive.

play11:52

And whenever this bit is equal to 1, then it indicates that the number is negative.

play11:57

So after the sign bit, the few bits are reserved for storing the exponent value.

play12:03

And then the remaining bits are reserved for storing this fractional part.

play12:07

So now if you see this significand, then here the integer part of this significand will

play12:12

always remain 1.

play12:14

And therefore, this 1 is not stored and instead of that only the fractional part is stored.

play12:21

So this fractional part is also referred as the mantissa or the significand.

play12:26

That means while storing this floating point number, we have total 3 parts.

play12:30

That is sign, exponent and the mantissa.

play12:33

Now to store this floating point number, a certain standard has been defined.

play12:38

Like how many bits will be reserved for the exponent as well as the mantissa part.

play12:42

And similarly, how to store this mantissa as well as the exponent part.

play12:46

Because this exponent part if you see, then it can be positive or the negative.

play12:51

That means we need to decide how to store this exponent part.

play12:55

So to store such numbers, a common standard has been defined.

play12:59

And one such commonly used standard is the IEEE 754.

play13:03

So in the next video, we will see the format of this IEEE standard and we will understand

play13:08

that as per this standard, how the floating numbers are stored.

play13:13

But I hope in this video, you understood the difference between the fixed point numbers

play13:16

and the floating point numbers.

play13:19

And using this floating point representation, how it is possible to represent the very large

play13:23

numbers or the very small numbers with good precision.

play13:27

So if you have any question or suggestion, then do let me know here in the comment section

play13:31

below.

play13:32

If you like this video, hit the like button and subscribe to the channel for more such

play13:36

videos.

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
Floating PointFixed PointDigital SystemsScientific NotationBinary NumbersIEEE 754Computer StorageNumber RepresentationPrecisionRange
¿Necesitas un resumen en inglés?