Videos like these are gold. I wish they were around 10 years ago when I started college. I am a bored, high-level front end developer. In an attempt to stimulate my mind, I started pursuing a spiraling sequence of steps that began with my attempt of building a command line game engine in C++. I realised how important it is to have a deep understanding of variable representation in memory. The feeling of "gambling" when you write a new line of code simply vanishes, as you regain control of what is happening under the hood. Thank you so much for your effort!
You are very welcome, and thanks for commenting. I believe it's important, whatever you do for a living, that you should never stop learning. And you're right, understanding the basics is always the place to begin. Good luck. :)KD
Thank you so much. I never got these questions right ever. My Paper 1 is in 2 days and honest to god you are a blessing and I think my grades may have been saved.
@@thereformist8718 I think it went well. I honestly expected way worse because my teacher was hyping P2. He said recursion comes up every year. I know I messed up every code question and the Dikstra but other than that, it was fine. But that means that 2025 exams are going to be so hard.
3:55 Allocation of bits to the mantissa and the exponent, both stored in 2's complement 5:05 Signed bit of the mantissa as a positive/negative as per 2's complement 5:26 Checking whether the exponent is positive/negative and implications for binary point 5:49 Converting to base 10 5:55 Step 1 - work out the value of the exponent in denary 6:10 Step 2 - float the binary point in the mantissa to the right/left according to the value of the exponent 6:46 Example 2 - 16 bit register (10 bit mantissa, 6 bit exponent) 7:45 Example 3 = positive value with negative exponent 8:25 Practice exercises (followed by solutions) 8:45 Further practice exercises with 4 bit mantissa and 4 bit exponent 9:08 Example with a negative number 10:08 Final example with a negative number 10:50 Practice exercises for negative numbers (followed by solutions)
Lifesaver! Thank you so much! The best explanation I found. 11 minutes could saved me whole yesterday, instead I was trying to understand that from my rubbish books. THANK YOU GOOD SIR!
You're very welcome. Don't give up on the books completely; it's a fast moving field so sometimes you have to dig around for fragments of information and piece them together. Slow learning is the deepest. :)KD
Thank you so much sir, now I am clear on this subject. the best part of the video is 4 practice questions with solution, based on practice questions , our knowledge on the subject can be concluded. Good job sir. Keep it up.
Time for the obligatory "Thank you for saving another aspiring EE student" Jokes aside. I truely am gratefull. Not to mention, that the explanation is excellent
This is so helpful!!! Thank you! This is *such* a confusing topic when you're first learning it and the textbook my professor picked for our class is insanely dense and full of confusing math formulas. He's a good professor but his lecture was still... not enough to fully grasp the concept for me. But now I feel like I actually understand it well!!! (which is good because I have both hw problems on this and a few insanely hard bitwise logic puzzles on this stuff to complete asap). You are really really really good at teaching and I am so grateful for this video!!
The knowledge you kind sir have bestowed upon me along with your soothing voice helped me a lot with the subject that I didnt quite understand until now. I just want to thank you for your effort =D
thank you so much, now i understand why is it called float , the -ve,+ve complementary thing and how very large or small values represented in binary machine
two questions: 1. Why is the base specifically always 2? 2. What happens when the exponent is much bigger than the mantissa, will there be enough bits to contain the result of the calculation?
Hi Andyson 1. A typical computer stores a number as a sequence of 1s and 0s (bits) inside a fixed size register. Each bit has a place value. Place values increase in powers of 2. This is not immediately obvious but it's worth keeping in mind how we were taught to count in base 10. Take another look at this: ua-cam.com/video/cJNm938Xwao/v-deo.html 2. If you were to allocate more of a register's bits to the exponent, you could have a greater range (much smaller and much bigger numbers), but you would have less bits for the mantissa so you would lose accuracy. Take a look at this: ua-cam.com/video/A2HflP5sa_0/v-deo.html :)KD
10:25 how come the fractional part value became negative? I think it must be negative mantisa (-2) + positive fractional (0.25 + 0.125) so the answer should be -1.625
for the second example at 9:00, when the value 0.111 is multiplied by 2^-2 5 digits are required to represent the resulting value. since there are 4 mantissa and 4 exponent digits how is the resulting value represented at the digitally? does the computer utilize exponent bits too?
1:17 technically that is the magnitude of the charge of an electron or the charge of a proton(or what used to be the charge of an electron iirc) but great video
Hi Joana. The leftmost 10 bits are the mantissa, and following 6 bits are the exponent. This particular way of encoding floating point numbers uses the format mantissa^exponent (mantissa raised to the power of the exponent). If all of the bits of the exponent are 1, when using two's complement, this represents -1 (in base 10). If this doesn't make sense please go back and watch this video. ua-cam.com/video/mRvcGijXI9w/v-deo.html Let me know how you get on :)KD
1:14 This is indeed elementary charge, but it's not the charge of an electron measured in coulombs, since electrons are, by definition, negatively charged. If you said "charge of a proton," everything would be correct, but if you're going to say "charge of an electron," you have to have a minus in front of it.
You are quite right. It would also have been correct if I had said, "this is the elementary charge which was once called the electron". I'll upload an edit soon. I would be interested to hear what you think of my forthcoming series on quantum mechanics.
hasnt it been implemented that there is "one more bit in mantisa"? hidden "1"? becouse binary exponencial form alwas starts with 1. ( and mantisa would store only bits after) i dont get it, pls help, i wanna know my floats
These are the place values of the binary digits. In base ten, we know that 357.46 is actually 3*100 + 5*10 + 7*1 + 4*0.1 + 6*0.01 In binary we know that 101.11 is actually 1*4 + 0*2 + 1*1 + 1*0.5 + 0.25 I mention this concept in my very first video about the binary number system.
@@ComputerScienceLessons ah thank you. I'm in my first month or two doing A level computer science and wanted to try get ahead of some of the teaching such as floating point calculations
I don't understand why the exponent is 2 instead of being 30 in the example 8:00, since it has the 1's in 16-8-4-2 in the exponent part. The same in the exercise at minute 8:33, the second example should give an exponent of -31, since it has 1s in 16-8-4-2-1 in the exponent part but the solution is an exponent of -1.
I found the answer, thks! *Computer Science* :"The exponent is in two's complement form. The most significant bit has a negative place value. Please take a look at my video on two's complement: ua-cam.com/video/mRvcGijXI9w/v-deo.html :)"
Hi everyone, I'm relatively new to computer science. Would anyone be kind enough to explain why the MSB for the exponent it -32 instead of 32? Thanks in advance!
Hi Ariel. The exponent needs to be encoded in two's complement form so that that it can represent positive or negative values (take a look at my video on two's complement if you are unfamiliar with the concept. ua-cam.com/video/mRvcGijXI9w/v-deo.html ). A negative exponent specifies that the binary point must float left, whereas a positive exponent specifies that it should float right. Having said that, there is another way to encode the exponent which is used in general purpose computers (like your PC) and that is covered in this video ua-cam.com/video/RuKkePyo9zk/v-deo.html :)KD
neat explanation using a sign bit in the exponent, but what about systems that use a biased exponent? Your mention of IEEE 754 standard leads one to wonder how you mispoke and used the term "mantissa". One of the revisions of the IEEE754 decided on using the term "significand". The revisions also decided on a biased exponent.
Dear KD, EDIT; nevermind I have noticed I made a math mistake on my part it is actually correct the way I interpret it I just didn't recount the numbers thanks for the video though it was very well done I was following your tutorial and found that in the first examples that you let us do ourselfs you made a mistake I think at the second exercise when you have to translate the 0.0101 to the decimals you say it's 0.3125 but then the binairy should say 0.011 am I wrong or correct? Hope you can help it's at 8:42 kind regards timo
Hi. In this particular scheme (used in various embedded and digital signal processing systems), both the mantissa and the exponent are stored in two's complement format. Two's complement is explained in this video: ua-cam.com/video/mRvcGijXI9w/v-deo.html Not that modern PCs use a different scheme, namely the IEEE 754 standard, which is described here: ua-cam.com/video/RuKkePyo9zk/v-deo.html :)KD
It depends on the system. You are probably referring to the IEEE754 standard used in general purpose computers. Systems for Digital Signal Processing (DSP), of which there are many, may use completely different formats for representing floating point binary numbers. At advanced level in the UK, students therefore study the general principles of floating point binary with different sized mantissas and exponents. Placing the exponent after the mantissa looks more like standard scientific form, but where it is actually stored in the processor depends on the architecture.
Videos like these are gold. I wish they were around 10 years ago when I started college. I am a bored, high-level front end developer. In an attempt to stimulate my mind, I started pursuing a spiraling sequence of steps that began with my attempt of building a command line game engine in C++. I realised how important it is to have a deep understanding of variable representation in memory. The feeling of "gambling" when you write a new line of code simply vanishes, as you regain control of what is happening under the hood.
Thank you so much for your effort!
You are very welcome, and thanks for commenting. I believe it's important, whatever you do for a living, that you should never stop learning. And you're right, understanding the basics is always the place to begin. Good luck. :)KD
Thank you so much. I never got these questions right ever. My Paper 1 is in 2 days and honest to god you are a blessing and I think my grades may have been saved.
How did you do?
@@thereformist8718 I think it went well. I honestly expected way worse because my teacher was hyping P2. He said recursion comes up every year. I know I messed up every code question and the Dikstra but other than that, it was fine. But that means that 2025 exams are going to be so hard.
3:55 Allocation of bits to the mantissa and the exponent, both stored in 2's complement
5:05 Signed bit of the mantissa as a positive/negative as per 2's complement
5:26 Checking whether the exponent is positive/negative and implications for binary point
5:49 Converting to base 10
5:55 Step 1 - work out the value of the exponent in denary
6:10 Step 2 - float the binary point in the mantissa to the right/left according to the value of the exponent
6:46 Example 2 - 16 bit register (10 bit mantissa, 6 bit exponent)
7:45 Example 3 = positive value with negative exponent
8:25 Practice exercises (followed by solutions)
8:45 Further practice exercises with 4 bit mantissa and 4 bit exponent
9:08 Example with a negative number
10:08 Final example with a negative number
10:50 Practice exercises for negative numbers (followed by solutions)
Thank you
great video man, when my teacher explained this made 0 sense over 3 lessons. Now I completely understand in 15 minutes!
Delighted to help :)KD
You seriously make the best computer science explanations on youtube.. just keep it coming! Your voice is also pretty soothing :]
Thanks for the lovely comment. :)KD
Lifesaver! Thank you so much! The best explanation I found. 11 minutes could saved me whole yesterday, instead I was trying to understand that from my rubbish books. THANK YOU GOOD SIR!
You're very welcome. Don't give up on the books completely; it's a fast moving field so sometimes you have to dig around for fragments of information and piece them together. Slow learning is the deepest. :)KD
Best and most helpful video on binary numbers I've EVER seen!
You are very kind. Thank you :)KD
Thank you so much sir, now I am clear on this subject. the best part of the video is 4 practice questions with solution, based on practice questions , our knowledge on the subject can be concluded. Good job sir. Keep it up.
You are very welcome. Thanks for the comment. :)KD
Time for the obligatory "Thank you for saving another aspiring EE student"
Jokes aside. I truely am gratefull. Not to mention, that the explanation is excellent
You are most welcome. Thanks for the lovely comment. :)KD
This video is really amazing. It solved the questions that came up with when I was first introduced to floating point numbers.
Delighted to help :)KD
Thank you very much for all your videos. It really helps out alot both when i was in advanced level and now in the university
Love from Cameroon 🇨🇲❤️
One of the best video I have come across so far.
Delighted to help. :)KD
I have degrees in German, International Studies, and music, and even I was able to understand this. Well done!
Du bist herzlich Willkommen :)KD
Thanks man for saving my A level
Delighted to help :)KD
This is the only explanation I found that makes sense, thank you!
You are most welcome :)KD
Thanks so much for this excellent explanation - you are putting teachers out of jobs !!
Oh my god, this is the best tutorial on ieee floating point ever, Thank you so much. I pray to you, it is so clear
the most clear explanation in the whole internet! thx
This is so helpful!!! Thank you! This is *such* a confusing topic when you're first learning it and the textbook my professor picked for our class is insanely dense and full of confusing math formulas. He's a good professor but his lecture was still... not enough to fully grasp the concept for me. But now I feel like I actually understand it well!!! (which is good because I have both hw problems on this and a few insanely hard bitwise logic puzzles on this stuff to complete asap).
You are really really really good at teaching and I am so grateful for this video!!
Thank you so much. I hope you stick with it, sometimes you have to dig around for what you need to make a concept click. :)KD
Perfect explanation, thank you. Good to have those try it yourself examples too to make sure its sunk in.
Thank you. Glad to help :)KD
Mantissa - precision
Exponent - range
Got it chief you the man
Tnx :)KD
Excess127 I don’t get this one
Excellent explanation and well animated. Seriously helped alot with differentiating to non -gcse cs students coming to a level
Thank you :)KD
Thank you so much for sharing your knowledge, sir!
You are most welcome. :)KD
The knowledge you kind sir have bestowed upon me along with your soothing voice helped me a lot with the subject that I didnt quite understand until now. I just want to thank you for your effort =D
thanks, my teacher didn't explain this at all, so it's kinda nice to see that left most bit in the exponent is always negative
Indeed - both the mantissa and the exponent are in two's complement, so the left most bit has a negative place value.
Thank you, the pdf I got given by the teacher was a huge mess, I appreciate the explanation.
Delighted to help. Take your time with this topic and do plenty of practice. :)KD
Thank you that was very well explained.
I had issues grasping it but now i fully understand it.
best computer science explanations.
may Allah help you like how you did with us
Thank you :)KD
Thank you excellent, tutorial. Very clear, I couldn't understand other tutorials bit this worked a treat :)
Glad to help. :)KD
do not like to write comments, but, big thanks for this video, great explanation
You are welcome. You comment is most appreciated :)KD
you always give us the best of explanations.....
Thank you :)KD
I love you , finally after 3 semester I understand it
Delighted to help :)KD
even water isn't clear like this. Thank you very much
Thank you. You're most welcome. :)KD
much better than my teachers, thank you so much!
What an amazing video. You explained it beautifully. Thank you s much!
...and than you. You are most welcome :)KD
thank you so much, now i understand why is it called float , the -ve,+ve complementary thing and how very large or small values represented in binary machine
Salute to sir for making such an informative video..
Thank you Mr. GENIUS !!
Thank you :)KD
Un millón de gracias.
Eres muy bienvenido
I LOVE THE ACCENT
Why the hell they dont teach it this way in studies? It's so much better
I guess it depends on the school. Delighted to help. :)KD
Excellent self explanatory video 👏🏽👏🏽👏🏽
two questions:
1. Why is the base specifically always 2?
2. What happens when the exponent is much bigger than the mantissa, will there be enough bits to contain the result of the calculation?
Hi Andyson
1. A typical computer stores a number as a sequence of 1s and 0s (bits) inside a fixed size register. Each bit has a place value. Place values increase in powers of 2. This is not immediately obvious but it's worth keeping in mind how we were taught to count in base 10.
Take another look at this: ua-cam.com/video/cJNm938Xwao/v-deo.html
2. If you were to allocate more of a register's bits to the exponent, you could have a greater range (much smaller and much bigger numbers), but you would have less bits for the mantissa so you would lose accuracy. Take a look at this: ua-cam.com/video/A2HflP5sa_0/v-deo.html
:)KD
Awesome content and also awesome brit slang.
Cor blimey guvna! :)KD
thank you for the amazing explanation!
You are welcome :)KD
thank you, just what i needed
You're welcome :)KD
Thanks for explaining so well!
You are very welcome :)KD
Thank you for the great video, the examples really helped
Thanks for the very informative lecture
You're very welcome :)KD
Thanks, this video was really helpful
You're welcome :)KD
9:50 the value should be -2 not -1.5 since you have -8+4+2 = -2
Not quite. The calculation is -8+4+2+0.5 = -1.5
10:25 how come the fractional part value became negative? I think it must be negative mantisa (-2) + positive fractional (0.25 + 0.125) so the answer should be -1.625
That's what I was thinking as well.
for the second example at 9:00, when the value 0.111 is multiplied by 2^-2 5 digits are required to represent the resulting value. since there are 4 mantissa and 4 exponent digits how is the resulting value represented at the digitally? does the computer utilize exponent bits too?
Very good explanation!
Thank you :)KD
Fantastic series
Very nice explanation
Thanks for making video
I am really confused at 9.56. -8+4+2=-2 . Should answer be -2.5?
It's -2 + 0.5 = -1.5
Not -2 - 0.5 = -2.5
According to the fact that the last bit of the exponent is positive not negative
Great video! So helpful
Thank you :)KD
Great video, thank you!
Thank you :)KD
1:17 technically that is the magnitude of the charge of an electron or the charge of a proton(or what used to be the charge of an electron iirc) but great video
You are quite right. I should have said 'elementary charge'. Good to have a scientist keeping me on my toes. :)KD
I have my Comupter Science CAIE in 21 days and I'm so stressed I'm forgetting everything and I cant study... thank you for helping
Super explain .very very useful
Thank you for this great tutorial...🙂🙂🙂🙂🙂
You are most welcome :)KD
Thank you. Now I know why single precision names "floating point".
You just gained an extra follow😁
Welcome and thanks :)KD
Very nice explanations
Thank you :)KD
Great video! But I have a question. In 8:43 why does 111111 equal 2^-1 ?
Hi Joana. The leftmost 10 bits are the mantissa, and following 6 bits are the exponent. This particular way of encoding floating point numbers uses the format mantissa^exponent (mantissa raised to the power of the exponent). If all of the bits of the exponent are 1, when using two's complement, this represents -1 (in base 10). If this doesn't make sense please go back and watch this video. ua-cam.com/video/mRvcGijXI9w/v-deo.html Let me know how you get on :)KD
@@ComputerScienceLessons Thank you so much, I understand it now, keep up the great work
You did a good job
Thank you :)KD
what is the difference between putting exponent behind mantissa and the IEEE 754 standard? Does the method remain the same, sir ?
Perfection!!
Thank you :)KD
1:14 This is indeed elementary charge, but it's not the charge of an electron measured in coulombs, since electrons are, by definition, negatively charged. If you said "charge of a proton," everything would be correct, but if you're going to say "charge of an electron," you have to have a minus in front of it.
You are quite right. It would also have been correct if I had said, "this is the elementary charge which was once called the electron". I'll upload an edit soon. I would be interested to hear what you think of my forthcoming series on quantum mechanics.
Thank you so much, this really helped me! Really struggled with this and I have CS exams coming up this week :)
Excellent
Tnx :) KD
Thx
Appreciate it ❤
Comment appreciated too :)KD
for some reason, I always get the second example question wrong. I don't understand why.
Make sure you study the solutions and try again. Life's greatest teacher - is failure.
:)KD
@@ComputerScienceLessons Thank you, I tried multiple times and I got the right answer finally.
This really helped tysm
7:27 why it always changed and why it didn’t start with 1-2-4-8-16-32 instead we have 0.125-0.25-…?
After the decimal point it goes 2^-1, 2^-2, 2^-3 etc.
where can I see the video to be watched after this one
They are in my playlist called Binary. I hope you like them.
so helpful for me
Should 1110 1000 00 | 000011 = -2.5?
Yes he mistakenly writes -1.5
Or we r doing any mistake I'm confused
hasnt it been implemented that there is "one more bit in mantisa"? hidden "1"? becouse binary exponencial form alwas starts with 1. ( and mantisa would store only bits after)
i dont get it, pls help, i wanna know my floats
ok i knwo it has something to IEEE
Uh where did you get the 0.5 and 0.25 from?
These are the place values of the binary digits.
In base ten, we know that 357.46 is actually 3*100 + 5*10 + 7*1 + 4*0.1 + 6*0.01
In binary we know that 101.11 is actually 1*4 + 0*2 + 1*1 + 1*0.5 + 0.25
I mention this concept in my very first video about the binary number system.
@@ComputerScienceLessons ah thank you. I'm in my first month or two doing A level computer science and wanted to try get ahead of some of the teaching such as floating point calculations
I don't understand why the exponent is 2 instead of being 30 in the example 8:00, since it has the 1's in 16-8-4-2 in the exponent part.
The same in the exercise at minute 8:33, the second example should give an exponent of -31, since it has 1s in 16-8-4-2-1 in the exponent part but the solution is an exponent of -1.
I found the answer, thks!
*Computer Science* :"The exponent is in two's complement form. The most significant bit has a negative place value. Please take a look at my video on two's complement: ua-cam.com/video/mRvcGijXI9w/v-deo.html
:)"
Hi everyone, I'm relatively new to computer science. Would anyone be kind enough to explain why the MSB for the exponent it -32 instead of 32?
Thanks in advance!
Beause if it was a 1 instead of 0 it would mean its a negative number(because its the first integer), so it would be -32 anyway.
Hi Ariel. The exponent needs to be encoded in two's complement form so that that it can represent positive or negative values (take a look at my video on two's complement if you are unfamiliar with the concept. ua-cam.com/video/mRvcGijXI9w/v-deo.html ). A negative exponent specifies that the binary point must float left, whereas a positive exponent specifies that it should float right. Having said that, there is another way to encode the exponent which is used in general purpose computers (like your PC) and that is covered in this video ua-cam.com/video/RuKkePyo9zk/v-deo.html :)KD
Thank this helped
My pleasure :)KD
Sir we want to follow same method for negative floating values !!! Answers are different if we use same method as positive floating numbers
neat explanation using a sign bit in the exponent, but what about systems that use a biased exponent? Your mention of IEEE 754 standard leads one to wonder how you mispoke and used the term "mantissa". One of the revisions of the IEEE754 decided on using the term "significand". The revisions also decided on a biased exponent.
Very helpful 👍😁
You're welcome :)KD
super helpfull!
You're welcome :)KD
Dear KD,
EDIT; nevermind I have noticed I made a math mistake on my part it is actually correct the way I interpret it I just didn't recount the numbers thanks for the video though it was very well done
I was following your tutorial and found that in the first examples that you let us do ourselfs you made a mistake I think at the second exercise when you have to translate the 0.0101 to the decimals you say it's 0.3125 but then the binairy should say 0.011 am I wrong or correct?
Hope you can help it's at 8:42
kind regards timo
Hello, can anybody help me understand why the left most bit on the exponent equals negative 36, and not a positive one? I would be really thankful!
Hi. In this particular scheme (used in various embedded and digital signal processing systems), both the mantissa and the exponent are stored in two's complement format. Two's complement is explained in this video:
ua-cam.com/video/mRvcGijXI9w/v-deo.html
Not that modern PCs use a different scheme, namely the IEEE 754 standard, which is described here:
ua-cam.com/video/RuKkePyo9zk/v-deo.html
:)KD
@@ComputerScienceLessons oh ok. Thank you so much for answering!!!
Why mantissa and exponen in the different plaxes first must be exponent and then mantissa
It depends on the system. You are probably referring to the IEEE754 standard used in general purpose computers. Systems for Digital Signal Processing (DSP), of which there are many, may use completely different formats for representing floating point binary numbers. At advanced level in the UK, students therefore study the general principles of floating point binary with different sized mantissas and exponents. Placing the exponent after the mantissa looks more like standard scientific form, but where it is actually stored in the processor depends on the architecture.
Very nice, although your last two examples don't seem to be normalised to begin with. Is that deliberate?
Thank you. Yes, normalisation is a concept I wanted to introduce later. :)KD
Use black background ...BTW your lectures are Amazing
What he'll is this accent shefild or bermigaham or Liverpool?
9:55 should its answer be -2.5??
-1.5 is correct. You need to take -8 then added every other place value to it. You will find that -2 plus 0.5 is indeed -1.5
:)KD
Isn't at 9:05 the answer on the second question 0.109375 instead of 0.21875 ?
I cannot wrap my head around this, no matter how i count it i always get the same answer.
My bad, I started counting bytes from 1/16 isntead of 1/8
Thanks
Welcome :)KD
This really helps!!!!
Glad to help :)KD