‹ BackHN Continuity

Thread

Subnormal floating-point numbers are expensive on Intel processors

69 points · 54 comments · zdw

  1. gwbas1c · · focus · HN ↗
    I'm still trying to understand what a subnormal number is; IE, I'm looking for the TLDR so I know just enough to know if I'm using them and need to learn more.

    Unfortunately, the Wikipedia article, while probably being accurate, doesn't give a clear and concise answer.

    IE, is 0.0001 a subnormal? Or is it 0.000000000000000000001?

    1. tialaramex · · focus · HN ↗
      The 32-bit subnormals are all the non-zero 32-bit floating point values between but not including -0.000000000000000000000000000000000000011754943508222875079687365372222456778186655567720875215087517062784172594547271728515625 and +0.000000000000000000000000000000000000011754943508222875079687365372222456778186655567720875215087517062784172594547271728515625

      Does that help you?

      [Edited: correct decimal after noticing that my calculator defaulted to the wrong setting]

      [And again because I think there's a bug in the last few digits, so debugging that's a fun activity for the weekend]

      [And a third time because nope, those were correct and I can't type]

      1. gwbas1c · · focus · HN ↗
        Yes, that's a perfect explanation!

        (And thankfully, for when I work with small numbers, they are still much larger than that.)

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.