Denormal Numbers - More Floating Point Madness!

Sdílet
Vložit
  • čas přidán 6. 09. 2024

Komentáře • 43

  • @nehavedam6373
    @nehavedam6373 Před 3 lety +15

    Finally a good explanation for denormal FP number online! :)

    • @NERDfirst
      @NERDfirst  Před 3 lety +2

      Hello and thank you very much for your comment! Glad you liked the video =)

  • @black-t-shirt2112
    @black-t-shirt2112 Před 2 lety +5

    This is a very important (and interesting) topic for me and you have explained it exceedenly well. Now I need to go back to study for my upcoming exam :S - I thank you for this video; I owe you a lot!

    • @NERDfirst
      @NERDfirst  Před 2 lety +1

      You're welcome! All the best for your exam!

  • @gubgubbubbub
    @gubgubbubbub Před rokem

    Nice video! :) It's worth mentioning another reason why denormal numbers are useful. Not only is it a way to cram in a few more numbers around zero; it also induces a useful property on the set of floating-point numbers: If the difference between two numbers, say x and y, is 0, then the numbers are equal (x-y = 0 -> x = y). This property fails on normalized-only floating-point numbers because the difference between the least and second-least positive normalized number is precisely the smallest denormal number, which would underflow to zero. But with denormals, it will never underflow.

    • @NERDfirst
      @NERDfirst  Před rokem

      Hello and thank you very much for sharing! Yes, there are lots of cool properties like this that I didn't get a chance to go through in this series. Might be worth a revisit sometime where we look at the actual implementation of floating point numbers.

  • @emiliomartineziii2980
    @emiliomartineziii2980 Před rokem +1

    Amazing Video! I was working on a problem for an hour but then in literally 30 seconds you answered everything!

    • @NERDfirst
      @NERDfirst  Před rokem

      Hello and thank you for your comment! Very happy to be of help =)

  • @shashvatshukla
    @shashvatshukla Před 2 lety +1

    Cheers man - sometimes you hear about something in a paper and just need a quick explainer. Glad to have found your video when I needed it. Also, are you from Singapore/Malaysia?

    • @NERDfirst
      @NERDfirst  Před 2 lety +1

      Hello and thank you very much for your comment! Glad to be of help =) Yes, I'm from Singapore!

  • @Averageyoutubeenjoyer-py9pl

    So what if the number instead of 2^130 is 2^250 and it exceeds the bit limit for the mantissa?

    • @NERDfirst
      @NERDfirst  Před 4 lety +1

      Hello and thank you for your comment! Since the number is so far above the limit, I'd expect you'd get significant losses.

    • @denischen8196
      @denischen8196 Před 3 lety +1

      If the number is too small even for denormal number, the number will underflow to 0.

  • @amkhrjee
    @amkhrjee Před rokem

    I'm confused. Why does the value -126 make the exponent go all zero? If the exponent of 2 is -126 then the offset exponent in the representation should be -126 + 127 = 1, so the binary representation should be 00000001, shouldn't it? What's so special about -126? I love your video but the nature of this topic is itself pretty confusing I guess, so it would be great if you could suggest some reading material on this. 💖

    • @NERDfirst
      @NERDfirst  Před rokem +1

      Hello and thank you for your comment! Why this happens is simply because it was designed this way - The definition of a floating point number states that a bit string of all zeros in the exponent is to be interpreted as -126 and for the mantissa to be denormal. Take this as a "special case", where we no longer read off the bits and treat it as an offset.
      Good reading material is simply the Wikipedia page for IEEE 754 floating point numbers: en.wikipedia.org/wiki/IEEE_754

  • @sum12319
    @sum12319 Před 2 lety +1

    Great explanation, thanks!

    • @NERDfirst
      @NERDfirst  Před 2 lety +2

      You're welcome! Very happy to be of help =)

  • @htxdy
    @htxdy Před 4 lety +5

    Still waiting for the third episode.. XD

    • @NERDfirst
      @NERDfirst  Před 4 lety +4

      Hello and thank you for your comment! There's another episode? I don't remember promising that =P
      Though I _have_ done three videos related to floating point numbers so far. You may be looking for the bit on infinity and NaN: czcams.com/video/D7LRjJeRKJw/video.html

  • @studytimewithjency
    @studytimewithjency Před 2 lety

    Though topic.. but explained clearly. thank you

    • @NERDfirst
      @NERDfirst  Před 2 lety

      You're welcome! Very happy to be of help :)

  • @phucnguyenkimthanh5455

    Hi, thanks for sharing this topic.
    Can you explain more detail why we have to make offset for the exponent part?
    As I read somewhere, there is some error when we convert to binary but I don't know what it is

    • @NERDfirst
      @NERDfirst  Před 4 lety +2

      Hello and thank you for your comment! You might want to start the first video in this series: czcams.com/video/gc1Nl3mmCuY/video.html
      Long story short, offsetting the exponent allows us to represent positive and negative exponent values.

  • @xzs432
    @xzs432 Před 4 lety

    Cool video! I was able to understand the binary to float but not the float to binary, At the extracting the mantissa you have your multiplication operations on both sides of the equal sign which to me from my knowledge of algebra says that both operations come to the same answer. to my understanding 2^-1 x 2 = 0.4 am i doing this wrong?

    • @NERDfirst
      @NERDfirst  Před 4 lety +2

      Hello and thank you for your comment! You might want to check your math!
      2^-1 = 1/2 = 0.5
      If we multiply that by two, 2 x 0.5 = 2 x (1/2) = 1 = 2^0

  • @OS2tuxbird
    @OS2tuxbird Před 3 lety

    Thank you for the video. For those who may be wondering how does this matter in real life (as in the working world ouside of academia and other schooling) I have encountered a problem with commercial real time programs where RTUs are reading a very tiny value close to but not zero. When the real time program polls the RTU and sees this, it causes the program to flag that value and ignore it based on how the product was developed. :( These tiny tiny tiny close to but not quite zero RTU values are not encountered often so when it is encountered people have to remember what is going on and how the program functions. Typically this involves a trouble call to the vendor and research on their part and ta-da De-normalized IEEE values... Too bad the RTUs are not programmed to round those tiny tiney tiny not quite zero values to zero so these problems don't pop up in the program :D Thank you once again :D

    • @NERDfirst
      @NERDfirst  Před 3 lety +1

      Hello and thank you for your comment and for sharing, what an interesting example! There are just so many things in the world of computing that we don't see in our day to day lives, until these edge cases come up!

  • @ahmetkarakartal9563
    @ahmetkarakartal9563 Před 2 lety

    Thank you for your video but I am so confused. 1.0 x 2^2 is equals to 0.1x2^3. and these two numbers can be representable but differently, how can I know which representation will be used?.

    • @NERDfirst
      @NERDfirst  Před 2 lety +2

      Hello and thank you very much for your comment! That's a very lucid point!
      However, the IEEE standard says that, outside of denormal numbers, the mantissa is always taken to be 1.x (with the 1 being implicit), so there is only one possible exponent value.
      As for denormal numbers, it can start with 0.x, with as many zeroes as required, but now, the exponent is fixed at 2^-126. So again, there is only one possible representation for any number.
      Thus thankfully, there should never be any ambiguity in any case.

    • @ahmetkarakartal9563
      @ahmetkarakartal9563 Před 2 lety +1

      @@NERDfirst thank you so much

  • @AlmogYosef520
    @AlmogYosef520 Před 4 lety

    Wow awesome!!
    I just saw the first video of floating point and entered to your channel and I saw this one also !
    Can you please make a video about the things you told at the end of the video ?
    Thanks!! :P

    • @NERDfirst
      @NERDfirst  Před 4 lety +1

      Hello and thank you very much for your comment! Sure, that'll be on its way in a few weeks =)

    • @zeferreira8805
      @zeferreira8805 Před 2 lety

      Europa League ahah

  • @dorifourer6949
    @dorifourer6949 Před rokem

    What if you have a denormalized number with a fraction : 000101100011..1
    How you deal with that ?

    • @NERDfirst
      @NERDfirst  Před rokem

      Hello and thank you for your comment! Perhaps you could clarify on what you mean when you say "deal with that"? The value can be read off in the same way as you would with any other floating point number.

  • @ngkhai5935
    @ngkhai5935 Před 4 lety

    Hi, i went to your website and realised that a Binary of 000000000.... actually is 0 in decimals. but since there is always a 1 imply before the mantissa, how can 0000000..... in Binary actually be 0 in decimal? Since 0(sign) * 2^[0-127] (Exponent) * [1+ .000000000....] ( mantissa), it will be 2^-127 * 1

    • @NERDfirst
      @NERDfirst  Před 4 lety +1

      Hello and thank you for your comment! A bit string of all zeroes is a special type of floating point number called a denormal number. More here: czcams.com/video/b2FgF2sUoS8/video.html

    • @cmyk8964
      @cmyk8964 Před 3 lety

      If the biased exponent is 0, the exponent is -126 instead of -127, and the leading digit of the mantissa is 0 instead of 1. (Paraphrasing the video)

    • @ScienceDiscoverer
      @ScienceDiscoverer Před 2 lety

      @@cmyk8964 But there could also be negative zero (if sign bit would be set), so you need to be careful when comparing float to be zero with integer type.

  • @user-hs7fd6sc9l
    @user-hs7fd6sc9l Před 4 lety

    Great video

    • @NERDfirst
      @NERDfirst  Před 4 lety +1

      Hello and thank you for your comment! Glad you liked the video =)

  • @bytwotea7488
    @bytwotea7488 Před 3 lety

    Is 0 considered a denormal number?

    • @NERDfirst
      @NERDfirst  Před 3 lety +1

      Hello and thank you for your comment! Since zero is represented with all bits set to zero, yes, it is a denormal number.