Binary 4 - Floating Point Binary Fractions 1

Поділитися
Вставка
  • Опубліковано 20 сер 2024

КОМЕНТАРІ • 281

  • @razvanbarbu278
    @razvanbarbu278 3 роки тому +90

    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!

    • @ComputerScienceLessons
      @ComputerScienceLessons  3 роки тому +11

      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

  • @rashida786ali1
    @rashida786ali1 2 місяці тому +2

    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
      @thereformist8718 2 місяці тому

      How did you do?

    • @rashida786ali1
      @rashida786ali1 2 місяці тому

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

  • @latedeveloper7836
    @latedeveloper7836 3 роки тому +63

    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)

  • @thomaslee7909
    @thomaslee7909 3 роки тому +17

    great video man, when my teacher explained this made 0 sense over 3 lessons. Now I completely understand in 15 minutes!

  • @h1k0usen13
    @h1k0usen13 4 роки тому +80

    You seriously make the best computer science explanations on youtube.. just keep it coming! Your voice is also pretty soothing :]

  • @Mateksk8oz
    @Mateksk8oz 4 роки тому +14

    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!

    • @ComputerScienceLessons
      @ComputerScienceLessons  4 роки тому +6

      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

  • @alexbukk556
    @alexbukk556 3 роки тому +3

    Best and most helpful video on binary numbers I've EVER seen!

  • @maruthiprasad8184
    @maruthiprasad8184 4 роки тому +9

    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.

  • @tyberfen5009
    @tyberfen5009 4 роки тому +40

    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

  • @timho1415
    @timho1415 Рік тому +3

    This video is really amazing. It solved the questions that came up with when I was first introduced to floating point numbers.

  • @Iamstephane
    @Iamstephane 2 роки тому +3

    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 🇨🇲❤️

  • @debarunkumer2019
    @debarunkumer2019 3 роки тому +1

    One of the best video I have come across so far.

  • @petersenglish
    @petersenglish 3 роки тому +2

    I have degrees in German, International Studies, and music, and even I was able to understand this. Well done!

  • @ontheway5792
    @ontheway5792 2 роки тому +2

    Thanks man for saving my A level

  • @noctua7771
    @noctua7771 3 роки тому +2

    This is the only explanation I found that makes sense, thank you!

  • @mortenlund1418
    @mortenlund1418 4 роки тому +3

    Thanks so much for this excellent explanation - you are putting teachers out of jobs !!

  • @AkimboFennec
    @AkimboFennec 2 роки тому

    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

  • @omarrandoms4157
    @omarrandoms4157 11 місяців тому

    the most clear explanation in the whole internet! thx

  • @LisaCalegari
    @LisaCalegari 2 роки тому +2

    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!!

    • @ComputerScienceLessons
      @ComputerScienceLessons  2 роки тому +1

      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

  • @ray.watts.44
    @ray.watts.44 2 роки тому +1

    Perfect explanation, thank you. Good to have those try it yourself examples too to make sure its sunk in.

  • @TheAmeer3881
    @TheAmeer3881 3 роки тому +2

    Mantissa - precision
    Exponent - range
    Got it chief you the man

  • @Mrmuhammedrahman
    @Mrmuhammedrahman 2 роки тому +1

    Excellent explanation and well animated. Seriously helped alot with differentiating to non -gcse cs students coming to a level

  • @alexanderscheffer3882
    @alexanderscheffer3882 4 роки тому +8

    Thank you so much for sharing your knowledge, sir!

  • @Quietlamacakes
    @Quietlamacakes 9 місяців тому

    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

  • @ragazoub
    @ragazoub 3 роки тому +1

    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

    • @ComputerScienceLessons
      @ComputerScienceLessons  3 роки тому

      Indeed - both the mantissa and the exponent are in two's complement, so the left most bit has a negative place value.

  • @danic8676
    @danic8676 2 роки тому +1

    Thank you, the pdf I got given by the teacher was a huge mess, I appreciate the explanation.

    • @ComputerScienceLessons
      @ComputerScienceLessons  2 роки тому

      Delighted to help. Take your time with this topic and do plenty of practice. :)KD

  • @tolgayatamturk2304
    @tolgayatamturk2304 4 роки тому +2

    Thank you that was very well explained.
    I had issues grasping it but now i fully understand it.

  • @hagnosis
    @hagnosis 2 роки тому +3

    best computer science explanations.
    may Allah help you like how you did with us

  • @Stopanimtz
    @Stopanimtz 4 роки тому +4

    Thank you excellent, tutorial. Very clear, I couldn't understand other tutorials bit this worked a treat :)

  • @olegkuzenko
    @olegkuzenko 4 роки тому +2

    do not like to write comments, but, big thanks for this video, great explanation

  • @hastarajrai215
    @hastarajrai215 3 роки тому +1

    you always give us the best of explanations.....

  • @shahryarhb6263
    @shahryarhb6263 2 роки тому +1

    I love you , finally after 3 semester I understand it

  • @emanelshamekh
    @emanelshamekh 3 роки тому +1

    even water isn't clear like this. Thank you very much

  • @psgkelvin4919
    @psgkelvin4919 4 роки тому +4

    much better than my teachers, thank you so much!

  • @JamesBrodski
    @JamesBrodski 3 роки тому +3

    What an amazing video. You explained it beautifully. Thank you s much!

  • @salehhassan9524
    @salehhassan9524 2 роки тому

    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

  • @beaconinternational1574
    @beaconinternational1574 2 роки тому

    Salute to sir for making such an informative video..

  • @Catholic_BB
    @Catholic_BB Рік тому +1

    Thank you Mr. GENIUS !!

  • @radamesvalentin
    @radamesvalentin 3 роки тому +1

    Un millón de gracias.

  • @Rob-xg9ws
    @Rob-xg9ws 10 місяців тому +1

    I LOVE THE ACCENT

  • @danegoulter4392
    @danegoulter4392 2 роки тому +1

    Why the hell they dont teach it this way in studies? It's so much better

  • @madeleinevargas8898
    @madeleinevargas8898 3 роки тому

    Excellent self explanatory video 👏🏽👏🏽👏🏽

  • @axedyson
    @axedyson 4 роки тому +4

    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?

    • @ComputerScienceLessons
      @ComputerScienceLessons  4 роки тому +2

      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

  • @prestoX
    @prestoX 3 роки тому +2

    Awesome content and also awesome brit slang.

  • @d30124
    @d30124 2 роки тому +1

    thank you for the amazing explanation!

  • @josuevaldez9663
    @josuevaldez9663 Рік тому +1

    thank you, just what i needed

  • @fabiharizvi4272
    @fabiharizvi4272 3 роки тому +1

    Thanks for explaining so well!

  • @timvw01
    @timvw01 Рік тому

    Thank you for the great video, the examples really helped

  • @mansorsaleh8698
    @mansorsaleh8698 3 роки тому +1

    Thanks for the very informative lecture

  • @vidunsewmithafonseka1258
    @vidunsewmithafonseka1258 3 роки тому +1

    Thanks, this video was really helpful

  • @deathtoy101
    @deathtoy101 3 роки тому +3

    9:50 the value should be -2 not -1.5 since you have -8+4+2 = -2

  • @mrx-qi8th
    @mrx-qi8th 2 роки тому +2

    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

    • @LasarMoon
      @LasarMoon Рік тому

      That's what I was thinking as well.

  • @erendurmus3962
    @erendurmus3962 Рік тому +1

    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?

  • @wojciechfioka5819
    @wojciechfioka5819 2 роки тому +1

    Very good explanation!

  • @MagnusAnand
    @MagnusAnand 2 роки тому

    Fantastic series

  • @royalegaming9801
    @royalegaming9801 3 роки тому

    Very nice explanation
    Thanks for making video

  • @omeghana
    @omeghana 2 роки тому +4

    I am really confused at 9.56. -8+4+2=-2 . Should answer be -2.5?

    • @deepblackoutlaw9640
      @deepblackoutlaw9640 10 місяців тому +1

      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

  • @hugoalonso8308
    @hugoalonso8308 3 роки тому +1

    Great video! So helpful

  • @loftylabs8629
    @loftylabs8629 2 роки тому +1

    Great video, thank you!

  • @Pimp482
    @Pimp482 3 роки тому +2

    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

    • @ComputerScienceLessons
      @ComputerScienceLessons  3 роки тому

      You are quite right. I should have said 'elementary charge'. Good to have a scientist keeping me on my toes. :)KD

  • @re1nh4rd7
    @re1nh4rd7 3 роки тому

    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

  • @sasindusahanweerakkodi7561
    @sasindusahanweerakkodi7561 4 роки тому +1

    Super explain .very very useful

  • @jseanlimpiado1565
    @jseanlimpiado1565 3 роки тому +1

    Thank you for this great tutorial...🙂🙂🙂🙂🙂

  • @yzwang4897
    @yzwang4897 3 роки тому

    Thank you. Now I know why single precision names "floating point".

  • @kingmoore2156
    @kingmoore2156 6 місяців тому +1

    You just gained an extra follow😁

  • @mansuralhassan9654
    @mansuralhassan9654 3 роки тому +1

    Very nice explanations

  • @joanalune
    @joanalune Рік тому +2

    Great video! But I have a question. In 8:43 why does 111111 equal 2^-1 ?

    • @ComputerScienceLessons
      @ComputerScienceLessons  Рік тому

      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

    • @joanalune
      @joanalune Рік тому

      @@ComputerScienceLessons Thank you so much, I understand it now, keep up the great work

  • @fabiharizvi4272
    @fabiharizvi4272 3 роки тому +1

    You did a good job

  • @SonNguyen-pj7nd
    @SonNguyen-pj7nd 4 роки тому +2

    what is the difference between putting exponent behind mantissa and the IEEE 754 standard? Does the method remain the same, sir ?

  • @mohamedhashem1938
    @mohamedhashem1938 3 роки тому +2

    Perfection!!

  •  4 роки тому

    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.

    • @ComputerScienceLessons
      @ComputerScienceLessons  4 роки тому

      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.

  • @missuniverse9250
    @missuniverse9250 2 роки тому

    Thank you so much, this really helped me! Really struggled with this and I have CS exams coming up this week :)

  • @ismetokatar6999
    @ismetokatar6999 4 роки тому +3

    Excellent

  • @Ivan-ou5nq
    @Ivan-ou5nq 9 місяців тому +2

    Thx

  • @deepblackoutlaw9640
    @deepblackoutlaw9640 10 місяців тому +1

    Appreciate it ❤

  • @ISAX16
    @ISAX16 2 роки тому +1

    for some reason, I always get the second example question wrong. I don't understand why.

    • @ComputerScienceLessons
      @ComputerScienceLessons  2 роки тому +1

      Make sure you study the solutions and try again. Life's greatest teacher - is failure.
      :)KD

    • @ISAX16
      @ISAX16 2 роки тому

      @@ComputerScienceLessons Thank you, I tried multiple times and I got the right answer finally.

  • @impulsiveguys7599
    @impulsiveguys7599 11 місяців тому

    This really helped tysm

  • @mister-ace
    @mister-ace 7 місяців тому

    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-…?

    • @arianagm2332
      @arianagm2332 6 місяців тому

      After the decimal point it goes 2^-1, 2^-2, 2^-3 etc.

  • @flueepwrien6587
    @flueepwrien6587 2 роки тому +1

    where can I see the video to be watched after this one

  • @youdontknowme7878
    @youdontknowme7878 2 роки тому

    so helpful for me

  • @nguyenkhai5178
    @nguyenkhai5178 4 роки тому +1

    Should 1110 1000 00 | 000011 = -2.5?

    • @siddiquiadnan92
      @siddiquiadnan92 3 роки тому

      Yes he mistakenly writes -1.5
      Or we r doing any mistake I'm confused

  • @bartlomiejodachowski
    @bartlomiejodachowski 2 роки тому +1

    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

  • @jp46614
    @jp46614 2 роки тому +2

    Uh where did you get the 0.5 and 0.25 from?

    • @ComputerScienceLessons
      @ComputerScienceLessons  2 роки тому +1

      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.

    • @jp46614
      @jp46614 2 роки тому

      @@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

  • @ospina79
    @ospina79 2 роки тому

    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.

    • @ospina79
      @ospina79 2 роки тому

      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
      :)"

  • @arielclement8734
    @arielclement8734 3 роки тому +2

    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!

    • @slavoljubkuroglavic1324
      @slavoljubkuroglavic1324 3 роки тому

      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.

    • @ComputerScienceLessons
      @ComputerScienceLessons  3 роки тому +1

      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

  • @exotical5647
    @exotical5647 2 роки тому +1

    Thank this helped

  • @sathya9494
    @sathya9494 Рік тому

    Sir we want to follow same method for negative floating values !!! Answers are different if we use same method as positive floating numbers

  • @elkscout1
    @elkscout1 2 роки тому

    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.

  • @aashuaditya1796
    @aashuaditya1796 Рік тому +1

    Very helpful 👍😁

  • @antonschell7939
    @antonschell7939 2 роки тому +1

    super helpfull!

  • @TimoDeWinter
    @TimoDeWinter Рік тому

    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

  • @rodrigorivers2469
    @rodrigorivers2469 3 роки тому +1

    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!

    • @ComputerScienceLessons
      @ComputerScienceLessons  3 роки тому

      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

    • @rodrigorivers2469
      @rodrigorivers2469 3 роки тому

      @@ComputerScienceLessons oh ok. Thank you so much for answering!!!

  • @serhatteoman6669
    @serhatteoman6669 4 роки тому +1

    Why mantissa and exponen in the different plaxes first must be exponent and then mantissa

    • @ComputerScienceLessons
      @ComputerScienceLessons  4 роки тому +1

      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.

  • @MrJustinRobertson
    @MrJustinRobertson 4 роки тому +1

    Very nice, although your last two examples don't seem to be normalised to begin with. Is that deliberate?

    • @ComputerScienceLessons
      @ComputerScienceLessons  4 роки тому

      Thank you. Yes, normalisation is a concept I wanted to introduce later. :)KD

  • @javikhan2017
    @javikhan2017 2 роки тому

    Use black background ...BTW your lectures are Amazing

  • @fiance-for11
    @fiance-for11 8 місяців тому

    What he'll is this accent shefild or bermigaham or Liverpool?

  • @sukshithshetty4847
    @sukshithshetty4847 3 роки тому +1

    9:55 should its answer be -2.5??

    • @ComputerScienceLessons
      @ComputerScienceLessons  3 роки тому

      -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

  • @flueepwrien6587
    @flueepwrien6587 2 роки тому +1

    Isn't at 9:05 the answer on the second question 0.109375 instead of 0.21875 ?

    • @flueepwrien6587
      @flueepwrien6587 2 роки тому

      I cannot wrap my head around this, no matter how i count it i always get the same answer.

    • @flueepwrien6587
      @flueepwrien6587 2 роки тому +1

      My bad, I started counting bytes from 1/16 isntead of 1/8

  • @lathikawathsara2649
    @lathikawathsara2649 4 роки тому +1

    Thanks

  • @benjararivoson7841
    @benjararivoson7841 4 роки тому +2

    This really helps!!!!