79. OCR A Level (H046-H446) SLR13 - 1.4 Floating point binary part 1 - Overview

Craig'n'Dave
8 Dec 202011:14

Summary

TLDRThis video is the first in a series explaining floating point binary representation. It begins with an 8-bit binary number line, illustrating how integers and fractions are represented. The video then transitions to fixed point binary, where the binary point's position is fixed, limiting the range of numbers that can be stored. To overcome this, floating point binary is introduced, where the binary point 'floats', allowing for a trade-off between the size and accuracy of numbers. The video explains the division of bits into the mantissa (value) and exponent (binary point position), crucial for storing real numbers in binary. Examples are provided to demonstrate how numbers are converted from floating point binary to decimal.

Takeaways

  • 📏 In floating point binary, the position of the binary point can change, allowing for the representation of both large and small numbers with varying degrees of precision.
  • 🔢 The binary number line's place values double as you move from right to left, which is different from unsigned binary or two's complement.
  • 👉 The most significant bit (leftmost bit) in floating point binary represents whether a number is negative or positive.
  • 📉 To represent fractions, the number line is extended to the right, with place values halving as you move from left to right.
  • 🚫 Fixed point binary has a limited range of numbers it can store accurately, as some bits are used for the fractional part of the number.
  • 🔄 The method of changing the position of the binary point to increase accuracy or range is known as floating point binary.
  • 💾 Storing a number in floating point binary requires splitting the bits into the mantissa (the actual value) and the exponent (the position of the binary point).
  • 📉 The number of bits used for the mantissa and exponent is determined by the data type, such as 24 bits for the mantissa and 8 for the exponent in a 32-bit single precision number.
  • ➕ The exponent in floating point binary is stored in two's complement, which indicates how many places to move the binary point.
  • 🔄 Moving the binary point to the right increases the size of the number, while moving it to the left decreases the size but can increase precision.

Q & A

  • What is the significance of the most significant bit in an 8-bit binary number representing a negative number?

    -In an 8-bit binary number representing a negative number, the most significant bit, which is the leftmost bit, must be a 1. This bit indicates that the number is negative.

  • How is the number 6.5 represented in fixed point binary format?

    -The number 6.5 is represented in fixed point binary format as 0011 0100. This representation includes a one in the four and two column (which equals six), plus a one in the half column, resulting in 6.5.

  • What is the largest positive number that can be stored in an 8-bit format using fixed point binary?

    -The largest positive number that can be stored in an 8-bit format using fixed point binary is 01111111, which equals 15.875 when calculated as 8 + 4 + 2 + 1 + 0.5 + 0.25 + 0.125.

  • Why can't the fraction 'a third' be accurately stored in the given fixed point binary format?

    -The fraction 'a third' cannot be accurately stored in the given fixed point binary format because the binary representation of a third (0.333...) would repeat infinitely, and the format does not allow for infinite precision.

  • How does the floating point binary system allow for a trade-off between the size and accuracy of numbers?

    -The floating point binary system allows for a trade-off between the size and accuracy of numbers by adjusting the position of the binary point. More bits can be allocated to the fractional part for higher accuracy, or to the whole number part for a larger range of values.

  • What are the two parts that the bits in a floating point binary number are split into, and what do they represent?

    -The bits in a floating point binary number are split into two parts: the mantissa, which represents the actual value of the number, and the exponent, which represents the position of the binary point within the number.

  • How many bits are used for the mantissa and exponent in a 32-bit single precision floating point number?

    -In a 32-bit single precision floating point number, 24 bits are used for the mantissa and 8 bits for the exponent.

  • What does the exponent in a floating point binary number indicate?

    -The exponent in a floating point binary number indicates how many places to move the binary point within the mantissa to determine the actual value of the number.

  • How is the position of the binary point determined in a floating point binary number?

    -The position of the binary point in a floating point binary number is determined by the exponent. The binary point starts after the most significant bit in the mantissa and is moved to the right or left based on the value of the exponent.

  • What is the significance of backfilling zeros in the mantissa of a floating point binary number?

    -Backfilling zeros in the mantissa of a floating point binary number is significant because it allows for the adjustment of the binary point's position without changing the value of the number. It is permissible as numerically, zeros are not significant.

Outlines

00:00

💡 Introduction to Floating Point Binary

This segment introduces the concept of floating point binary representation in a three-part series. It explains the binary number line, highlighting the difference between unsigned binary and two's complement systems. The significance of the most significant bit in representing negative numbers is discussed. The video uses an 8-bit example to demonstrate how to represent whole numbers and fractions, such as 6.5 and 3.75, in binary. The concept of fixed point binary is introduced, where the position of the binary point is fixed, and the limitations in the range of numbers that can be represented are discussed. The example of representing a third (0.333) is used to show the inaccuracy that can occur with fixed point representation. The video concludes by discussing the need for a more flexible system to increase accuracy, hinting at the floating point binary system.

05:00

🔍 Exploring Floating Point Binary

This part of the video delves deeper into floating point binary representation. It explains how the binary point can 'float' to increase the size or accuracy of the number being represented. The trade-off between the range of numbers and their precision is discussed, using examples to show how the binary point's position affects the number's size and accuracy. The segment introduces the concept of the mantissa and exponent in floating point binary, explaining how the bits are split to represent the number's value and the position of the binary point. The video uses examples to demonstrate how to convert floating point binary numbers into decimal, emphasizing the importance of the exponent in determining the binary point's final position. The examples illustrate how the mantissa and exponent work together to represent numbers like 6, 1.75, and 0.125 in floating point binary.

10:02

📚 Understanding the Storage of Fractions in Computers

The final segment of the video focuses on how computers store fractions or real numbers using floating point binary. It explains the process of moving the binary point based on the exponent and how to disregard the exponent after determining the point's position. The video uses a negative exponent example to show how the binary point is moved to the left, and how zeros are backfilled to complete the number. The segment concludes by posing a key question to the viewer: how does a computer store fractions or real numbers? This question is meant to reinforce the understanding of floating point binary representation and its importance in computer science.

Mindmap

Keywords

💡Floating Point Binary

Floating Point Binary is a method used by computers to represent real numbers, which includes both whole numbers and fractions. Unlike fixed-point binary, where the position of the binary point is fixed, floating point binary allows the point to 'float' or move. This flexibility enables the representation of a wide range of numbers with varying degrees of precision. In the video, the concept is introduced as a way to store numbers with fractional components, and it's explained that the size of the number that can be stored can be increased or decreased depending on how many bits are used for the fractional component.

💡Binary Number Line

The Binary Number Line is a visual representation used in the video to explain how numbers are represented in binary form. It shows how place values double as you move from right to left, which is different from the decimal system. This concept is fundamental to understanding how binary numbers work and is used to demonstrate the representation of both positive and negative numbers.

💡Mantissa

The Mantissa in floating point binary represents the significant digits of a number. It is the part of the number that is stored after the binary point has been moved to its correct position. The video explains that the mantissa is one of the two parts into which the bits are split, with the other part being the exponent. The number of bits used for the mantissa can vary depending on the data type, and it determines the precision of the stored number.

💡Exponent

In the context of floating point binary, the Exponent indicates the position of the binary point relative to the most significant bit of the mantissa. The video explains that the exponent is stored in two's complement form, and it tells us how many places to move the binary point to the right (for positive exponents) or to the left (for negative exponents). The exponent is crucial for adjusting the size of the number that can be represented.

💡Two's Complement

Two's Complement is a method for representing negative numbers in binary. The video mentions that the most significant bit of a number is used to indicate whether it is negative or positive. In two's complement, a negative number is represented by inverting all the bits of its positive counterpart and then adding one. This system is used for both the mantissa and the exponent in floating point binary.

💡Fixed Point Binary

Fixed Point Binary is a system where the position of the binary point is fixed, and it is used to represent numbers with a fractional component. The video contrasts this with floating point binary, explaining that in fixed point, the range of numbers that can be stored is more limited because some positions on the number line are used to store the fractional part of the number.

💡Place Values

Place Values in binary, as in any number system, refer to the value of a digit based on its position. In binary, place values double as you move from right to left, which is different from the decimal system where they increase by a factor of ten. The video uses the concept of place values to explain how binary numbers are constructed and how they represent both positive and negative values.

💡Most Significant Bit (MSB)

The Most Significant Bit (MSB) is the leftmost bit in a binary number and plays a crucial role in determining the sign of the number in two's complement representation. The video explains that if the MSB is a 1, the number is negative, and if it's a 0, the number is positive. This is a fundamental concept in understanding how binary numbers represent both magnitude and sign.

💡Precision

Precision in the context of floating point binary refers to the accuracy or the number of significant digits that can be represented. The video discusses how the precision of a number can be increased by using more bits for the fractional component, but this comes at the cost of reducing the range of numbers that can be represented.

💡Data Type

A Data Type in computing defines the kind of data a variable can hold and the operations that can be performed on it. The video mentions different data types, such as 32-bit single precision, which uses a specific number of bits for the mantissa and the exponent. Understanding data types is essential for knowing how numbers are stored and processed in a computer system.

Highlights

Introduction to floating point binary in a three-part series.

Explanation of 8-bit binary number line with place values doubling to the left.

Differentiation between unsigned binary and two's complement for representing negative numbers.

Representation of the number six in binary as 00000110.

Extension of the number line for fractional components, halving place values to the right.

Binary representation of 6.5 as 001101000.

Binary representation of 3.75 as 00011110.

Storing negative numbers with fractional components using the most significant bit.

Binary representation of -6.5 as 110001100.

Definition and example of fixed point binary with a fixed position for the binary point.

Limitation in the range of numbers storable in fixed point binary due to fractional part usage.

Challenge of accurately representing fractions like a third in fixed point binary.

Introduction to floating point binary with a floating binary point for increased flexibility.

Trade-off between number size and accuracy in floating point binary representation.

Explanation of mantissa and exponent in floating point binary to store the number and binary point position.

Example of storing the number 110001 in floating point binary with 5 bits for mantissa and 3 for exponent.

Conversion process from floating point binary to base 10 using the mantissa and exponent.

Handling of negative exponents in floating point binary and their effect on binary point movement.

Final example demonstrating the storage of 0.125 in floating point binary with negative exponent.

Summary of how floating point binary allows for dynamic adjustment of number size and accuracy.

Transcripts

play00:00

this video is part one in a three-part

play00:03

series on floating point binary

play00:05

in this video we provide an overview of

play00:07

the topic

play00:09

[Music]

play00:15

look at this 8-bit binary number line

play00:18

note how the place values double as we

play00:21

move right to left

play00:23

unlike unsigned binary with two's

play00:25

complement the leftmost bit the most

play00:27

significant bit

play00:28

always represents a negative number

play00:34

so the number six would be represented

play00:36

as zero zero zero zero

play00:38

zero one one zero that's a one in the

play00:41

four column

play00:41

plus a one in the two column four plus

play00:43

two is six

play00:46

to store numbers with a fractional

play00:48

component such as six point five

play00:51

we extend the number line from left to

play00:53

right

play00:54

note how the place values now half as we

play00:57

move from left to right

play00:58

we place a binary point between the 1

play01:01

and the half

play01:06

using this format 6.5 will be

play01:08

represented as 0 0

play01:10

1 1 zero one zero zero

play01:13

so that's a one in the four and two

play01:15

column four plus two is six

play01:16

plus a one and a half column for six

play01:19

point five

play01:23

the number three point seven would be

play01:25

represented as zero zero zero one

play01:28

one one one zero so a two plus a one

play01:31

is three plus a half is three point five

play01:34

plus a quarter is three point seven five

play01:41

we can also easily store negative

play01:43

numbers with a fractional component

play01:45

using this format

play01:46

remember if this is a negative number

play01:48

the most significant bit that's the

play01:50

leftmost bit must be a 1.

play01:53

so using this format minus 6.5 will be

play01:56

represented as 1

play01:57

1 0 0 1 1 0 0 that's minus 16

play02:02

plus an 8 bring it up to 8 plus a 1

play02:05

bringing us up to 7 plus a half bringing

play02:08

us up to

play02:09

minus 6.5

play02:15

this method of storing is known as fixed

play02:18

point binary

play02:19

as the position of the point is fixed on

play02:22

the number line

play02:24

note that the range of numbers we can

play02:25

now store is more limited

play02:27

as some positions on the number line are

play02:29

now being used to store

play02:30

the fractional part of the number

play02:36

biggest positive number we could now

play02:38

store in this eight bit format

play02:40

is zero one one one one one

play02:43

one an eight plus a four plus a two plus

play02:46

a one

play02:46

plus a half quarter and an eighth or

play02:50

15.875

play02:54

now you may have spotted that some

play02:57

numbers

play02:58

can't be stored accurately at all

play03:01

so looking at the format we've got on

play03:02

the screen now how would you store

play03:04

a third

play03:08

well the best we could manage in this

play03:10

format would be zero

play03:12

zero zero zero zero zero one zero

play03:16

which represents a quarter or 0.25

play03:19

not a third however it's the closest we

play03:22

can get

play03:23

in this format

play03:27

we could extend the number line to allow

play03:30

for more fractional parts

play03:32

and therefore more accuracy but the

play03:34

pattern just repeats

play03:35

one zero one zero one zero and it

play03:38

actually repeats forever

play03:40

we can't actually ever represent a third

play03:44

precisely

play03:48

to increase accuracy we can change

play03:52

the way we use the binary point

play03:55

while we're still using eight bits to

play03:57

store the number here the eight bits on

play03:59

the number line

play04:00

change

play04:04

to put it another way the binary point

play04:06

is floating

play04:08

up and down the number line

play04:22

in this example we're using 8 bits from

play04:26

-8 to 1 16 4 bits for the whole number

play04:30

and 4 bits for the fractional component

play04:37

in this example we're still using 8 bits

play04:39

but this time the numbers from -64

play04:42

down to a half so we're using seven bits

play04:44

for the whole number

play04:45

and only one bit for the fractional part

play04:48

note how the size of the number we can

play04:50

store has increased

play04:51

but that's at the cost of reduced

play04:54

accuracy

play04:58

and in this example we're still using

play05:00

eight bits

play05:02

from minus four but this time all the

play05:03

way down to one thirty second

play05:06

that's three bits for the whole number

play05:07

and a whole five bits for the fractional

play05:09

part

play05:10

so the size of the number we can store

play05:12

has now really decreased

play05:14

but we can now store it with a much

play05:16

higher degree of accuracy

play05:18

or precision

play05:22

now the important takeaway here is that

play05:24

the binary point is

play05:26

moving it's floating up and down the

play05:28

number line

play05:29

as it does we can use more or fewer bits

play05:32

to store the fractional component

play05:34

and this is known as floating point

play05:36

binary

play05:37

the big advantage of this approach with

play05:39

just eight bits is we can either choose

play05:41

to increase the size of the number

play05:43

or the accuracy of the number

play05:49

now it may not have escaped or noticed

play05:51

that with floating point binary

play05:53

we've actually introduced a new problem

play05:56

along with the actual number which we

play05:58

need to store in binary

play05:59

we also need to store the position of

play06:02

the binary point

play06:03

on the number line

play06:07

we do this by splitting the bits into

play06:09

two parts

play06:10

the mantissa which is going to represent

play06:12

the actual value of the number itself

play06:15

and an exponent the position of the

play06:17

binary point

play06:18

within that number the number of bits

play06:21

used for mantis for an exponent is

play06:23

determined by the data type

play06:25

a 32-bit single precision number uses 24

play06:29

bits for the mantissa

play06:30

and 8 for the exponent giving 24 bits of

play06:33

precision

play06:34

now in the exam the number of bits used

play06:36

for mantissa for an exponent will always

play06:38

be stated

play06:39

in this example we're going to have five

play06:41

bits for mantissa

play06:42

and three for the excellent

play06:47

so let's look at an example of a number

play06:49

being stored in floating point binary

play06:52

we're going to go with zero one one zero

play06:54

zero

play06:55

zero one one with the first five bits

play06:57

for mantissa

play06:58

and the last three bits for the exponent

play07:02

to convert this into base 10 dna we

play07:06

first have to look at the exponent as

play07:08

this is going to tell us

play07:09

where the binary point is going to need

play07:12

to end up

play07:14

note that the binary point always starts

play07:17

after

play07:17

the most significant bit in the mantissa

play07:20

between the first two digits but that's

play07:21

not

play07:22

where it's going to end up we're going

play07:24

to move it

play07:25

based on this exponent

play07:29

so we start by converting the exponent

play07:31

now note

play07:32

the most significant bit is representing

play07:35

negative four because we store it in

play07:36

two's complement

play07:38

so our exponent is three we've got a one

play07:40

in the two column

play07:41

and a one in the one column two plus one

play07:43

is three

play07:47

so our exponent of three is telling us

play07:48

we need to move the binary point in our

play07:51

mantissa

play07:52

three places to the right we move it to

play07:55

the right

play07:56

because the exponent is positive

play08:02

now we're finished with the exponent now

play08:04

all it was doing was storing how many

play08:06

places to move the binary point

play08:07

now we've moved it we can ignore it so

play08:10

we're now left with the number

play08:11

not one one naught point naught

play08:15

we apply the normal binary waiting line

play08:17

and add up

play08:18

any columns that have a one in them

play08:20

again note the most significant bit is

play08:22

representing minus eight not positive

play08:24

because we're using two's complement so

play08:26

we've got a one in the four column and a

play08:28

one in the two

play08:29

four plus two is six so that's what this

play08:31

actual number

play08:32

was representing the dna value six

play08:38

okay let's have another look at another

play08:39

example again eight bits

play08:42

five for the mantissa and three for the

play08:44

exponent this number is zero one one one

play08:46

zero

play08:47

zero zero one

play08:51

now our exponent is one that's all we've

play08:54

got here nothing in the two column

play08:55

nothing in the minus four

play08:56

so it tells us to move the binary point

play08:58

in the mantissa

play08:59

one place to the right positive exponent

play09:03

moves the binary point to the right

play09:08

finished with the exponent so we

play09:09

disregard it and we end up with the

play09:11

number zero one

play09:12

point one one zero we apply the normal

play09:15

binary waiting line

play09:17

and add up any columns with a one in we

play09:19

have a one

play09:20

plus a half plus a quarter so this

play09:23

number

play09:24

is 1.75

play09:29

okay in this final example we're going

play09:31

to use a negative exponent so again 8

play09:34

bits

play09:34

5 for the mantissa three for the

play09:36

exponents the full number

play09:37

zero one zero zero zero one one zero

play09:43

so we start by working out the exponent

play09:45

the exponent is

play09:46

minus two minus four plus two is minus

play09:48

-2

play09:49

so we need to move the binary point in

play09:51

our mantissa

play09:52

two places to the left this time because

play09:55

it's a negative

play09:56

exponent now we can't easily move the

play09:59

binary point off the left of this screen

play10:01

visually so we're just going to slide

play10:03

the bits across two places which serves

play10:05

the same purpose

play10:14

we can now disregard the exponent and we

play10:16

end up with

play10:17

zero point zero zero one zero zero zero

play10:20

we apply the normal binary waiting line

play10:22

and add up the columns with a one

play10:24

all we've got is a one in the eighth

play10:26

column so this number was naught

play10:27

point one two five note how we had to

play10:31

backfill for a couple of zeros to make

play10:32

the number work

play10:34

this is allowed as numerically zeros are

play10:36

not significant

play10:37

if the number is positive we can always

play10:40

backfill with zeros as needed

play10:42

if the number is negative we backfill

play10:44

with ones as needed instead

play10:48

having watched this video you should be

play10:50

able to answer the following key

play10:51

question

play10:52

how does a computer store fractions or

play10:55

real numbers

play11:02

[Music]

play11:13

you

Rate This

5.0 / 5 (0 votes)

相关标签
Floating PointBinary NumbersComputer ScienceData StorageNumber SystemsMantissaExponentTwo's ComplementFractionsAccuracy
您是否需要英文摘要?