Subnormal floating-point numbers are expensive on Intel processors
Thread
Unofficial Hacker News client; not affiliated with Y Combinator.
Subnormal floating-point numbers are expensive on Intel processors
Unofficial Hacker News client; not affiliated with Y Combinator.
gwbas1c · · focus · HN ↗
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?
tialaramex · · focus · HN ↗
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]
nayuki · · focus · HN ↗
Mechanically speaking, the two zeros use the subnormal number format, so in that sense they are subnormal (but definitionally they aren't). Also, I guess FPUs treat zero differently from other subnormal numbers, which is why zero doesn't have a performance penalty.
Relevant articles to read: <a href="https://stackoverflow.com/questions/73890260/why-is-zero-not-a-subnormal-number" rel="nofollow">https://stackoverflow.com/questions/73890260/why-is-zero-not... , <a href="https://en.wikipedia.org/wiki/Sterbenz_lemma" rel="nofollow">https://en.wikipedia.org/wiki/Sterbenz_lemma , <a href="https://en.wikipedia.org/wiki/Subnormal_number" rel="nofollow">https://en.wikipedia.org/wiki/Subnormal_number