Denormal Numbers - More Floating Point Madness!

Поделиться
HTML-код
  • Опубликовано: 3 июл 2024
  • We have previously seen floating point numbers, and the logic that goes into how they can represent numbers with a fractional portion. However, there's one edge case I missed out in my original video, that merits a whole video of its own!
    Haven't seen the original floating point video? Check it out here → • Floating Point Numbers
    Try out the new and improved simulation → resources.nerdfirst.net/float
    = 0612 TV =
    0612 TV, a sub-project of NERDfirst.net, is an educational RUclips channel. Started in 2008, we have now covered a wide range of topics, from areas such as Programming, Algorithms and Computing Theories, Computer Graphics, Photography, and Specialized Guides for using software such as FFMPEG, Deshaker, GIMP and more!
    Enjoy your stay, and don't hesitate to drop me a comment or a personal message to my inbox =) If you like my work, don't forget to subscribe!
    Like what you see? Buy me a coffee → www.nerdfirst.net/donate/
    0612 TV Official Writeup: nerdfirst.net/0612tv
    More about me: about.me/lcc0612
    Official Twitter: / 0612tv
    = NERDfirst =
    NERDfirst is a project allowing me to go above and beyond RUclips videos into areas like app and game development. It will also contain the official 0612 TV blog and other resources.
    Watch this space, and keep your eyes peeled on this channel for more updates! nerdfirst.net/
    -----
    Disclaimer: Please note that any information is provided on this channel in good faith, but I cannot guarantee 100% accuracy / correctness on all content. Contributors to this channel are not to be held responsible for any possible outcomes from your use of the information.

Комментарии • 43

  • @nehavedam6373
    @nehavedam6373 3 года назад +15

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

    • @NERDfirst
      @NERDfirst  3 года назад +2

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

  • @emiliomartineziii2980
    @emiliomartineziii2980 Год назад +1

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

    • @NERDfirst
      @NERDfirst  Год назад

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

  • @black-t-shirt2112
    @black-t-shirt2112 2 года назад +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  2 года назад +1

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

  • @gubgubbubbub
    @gubgubbubbub Год назад

    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  Год назад

      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.

  • @sum12319
    @sum12319 2 года назад +1

    Great explanation, thanks!

    • @NERDfirst
      @NERDfirst  2 года назад +2

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

  • @shashvatshukla
    @shashvatshukla 2 года назад +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  2 года назад +1

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

  • @user-hs7fd6sc9l
    @user-hs7fd6sc9l 4 года назад

    Great video

    • @NERDfirst
      @NERDfirst  4 года назад +1

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

  • @AlmogYosef520
    @AlmogYosef520 4 года назад

    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  4 года назад +1

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

    • @zeferreira8805
      @zeferreira8805 2 года назад

      Europa League ahah

  • @htxdy
    @htxdy 4 года назад +5

    Still waiting for the third episode.. XD

    • @NERDfirst
      @NERDfirst  4 года назад +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: ruclips.net/video/D7LRjJeRKJw/видео.html

  • @studytimewithjency
    @studytimewithjency 2 года назад

    Though topic.. but explained clearly. thank you

    • @NERDfirst
      @NERDfirst  2 года назад

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

  • @phucnguyenkimthanh5455
    @phucnguyenkimthanh5455 3 года назад

    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  3 года назад +2

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

  • @xzs432
    @xzs432 4 года назад

    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  4 года назад +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

  • @Averageyoutubeenjoyer-py9pl
    @Averageyoutubeenjoyer-py9pl 3 года назад +2

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

    • @NERDfirst
      @NERDfirst  3 года назад +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 3 года назад +1

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

  • @ahmetkarakartal9563
    @ahmetkarakartal9563 2 года назад

    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  2 года назад +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 2 года назад +1

      @@NERDfirst thank you so much

  • @OS2tuxbird
    @OS2tuxbird 3 года назад

    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  3 года назад +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!

  • @ngkhai5935
    @ngkhai5935 4 года назад

    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  4 года назад +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: ruclips.net/video/b2FgF2sUoS8/видео.html

    • @cmyk8964
      @cmyk8964 2 года назад

      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 Год назад

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

  • @amkhrjee
    @amkhrjee Год назад

    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  Год назад +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

  • @dorifourer6949
    @dorifourer6949 Год назад

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

    • @NERDfirst
      @NERDfirst  Год назад

      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.

  • @bytwotea7488
    @bytwotea7488 2 года назад

    Is 0 considered a denormal number?

    • @NERDfirst
      @NERDfirst  2 года назад +1

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