Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Bend 2 and the Vibe-Coding Trap(liampwll.com ↗)
    91comments
  2. An Empirical Study of Harness Design for Coding Agents(arxiv.org ↗)
    discuss
  3. OpenJev(openjev.com ↗)
    149comments
  4. ZCode, the GLM coding agent, silently uploads your Git history(tokenstead.ai ↗)
    37comments
  5. Subnormal floating-point numbers are expensive on Intel processors(lemire.me ↗)
    14comments
  6. Jemalloc 5.4.0(github.com/jemalloc ↗)
    58comments
  7. I don't like passkeys(hawksley.dev ↗)
    128comments
  8. The Shadows Lurking in the Equations – Underwater Islands(gods.art ↗)
    1comments
  9. Cekura (YC F24) Is Hiring(ycombinator.com ↗)
    discuss
  10. Microsoft exec called AI scraping 'the largest theft of labor in human history'(techcrunch.com ↗)
    348comments
  11. Warren Buffett Steps Down as Berkshire Chairman, Names Son to Replace Him(nytimes.com ↗)
    67comments
  12. The scourge of x86 emulation(fex-emu.com ↗)
    50comments
  13. Replacing Pull Requests with Delta(zed.dev ↗)
    30comments
  14. Bonsai 2 27B: Near-Lossless Compression in a 9x Smaller Footprint(prismml.com ↗)
    156comments
  15. Astra for Law(openai.com ↗)
    630comments
  16. Bend – A language that blocks AI mistakes via proof, on CPU and GPU(bend-lang.com ↗)
    254comments
  17. Qwen 3.8 Omni Flash(qwen.ai ↗)
    97comments
  18. Hister: A private search engine for the pages you visit and the files you keep(github.com/asciimoo ↗)
    174comments
  19. Wax motor(wikipedia.org ↗)
    80comments
  20. When the fractional part of a float fixes your shader(crocidb.com ↗)
    10comments
  21. Fujitsu launches made-in-Japan next-generation CPU FUJITSU-MONAKA(global.fujitsu ↗)
    239comments
  22. Pre-Greek: The lost language hidden within Ancient Greek(linguisticdiscovery.com ↗)
    53comments
  23. If materialism is true, the United States is probably conscious(jstor.org ↗)
    3comments
  24. How to Write with an LLM(sockpuppet.org ↗)
    150comments
  25. A heap overflow and SSO misconfiguration to compromise OpenAI internal repos(hacktron.ai ↗)
    165comments
  26. Dr Julius Neubronner's Miniature Pigeon Camera(publicdomainreview.org ↗)
    discuss
  27. Shapelearn Qwen 3.8 27B (13.1 GB VRAM)(byteshape.com ↗)
    22comments
  28. Ask A Monk – A digital wilderness for thoughts with no immediate answer(askamonk.online ↗)
    28comments
  29. Flet 1.0 – Build cross-platform apps in Python(flet.dev ↗)
    74comments
  30. Telstra outage: The night a network decided the year was 2006(netnod.se ↗)
    30comments

Subnormal floating-point numbers are expensive on Intel processors

37 pointsby 2d agolemire.me
14 comments
1h agoHN ↗

...Is this running extra micro code to fix some hardware bug/unreliability? How can this happen? Doesn't look like a normal design decision.

1h agoHN ↗

Subnormal numbers have a different, basically fixed-point, representation. They exist in order to bridge the large (relatively speaking; indeed "infinite" in a sense) gap between the least positive normal number, zero, and the greatest negative normal number, caused by the usual significand-exponent representation.

Most "mundane" uses of floating point have no need for subnormal numbers, and numbers that underflow could just be flushed to zero. But they’re sometimes important in scientific computing to ensure sufficient smoothness around zero, avoiding precision issues.

1h agoHN ↗

I don’t know if any bugs contribute to this but this in the intel case but it has been very common historically for subnormal performance to be lower on many processors, and things like the Alpha required you to handle them in software if the COU fired a trap.

Have a look at https://en.wikipedia.org/wiki/Subnormal_number for some context.

27m agoHN ↗

It's to satisfy IEEE 754 and it's been this way for decades.

25m agoHN ↗

Does that mean that the ARM processors in the writeup are not satisfying IEEE 754?

13m agoHN ↗

It probably means Apple spent the silicon to handle subnormals at full speed in hardware, rather than triggering a slow microcode handler for such numbers.

1h agoHN ↗

Apparently it only happens on P-cores, recent E-cores have a fast path for subnormals.

17m agoHN ↗

That seems weird. They did throw extra hardware at it to speed it up for the efficient cores, but not for the performance cores?

44m agoHN ↗

If you don't _need_ subnormals MXCSR.DAZ/FTZ (which you can get gcc to set via -mdaz-ftz) will let you ignore all of this.

16m agoHN ↗

IIRC intel’s compilers enable FTZ/DAZ, at least at higher optimization levels.

19m agoHN ↗

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?

2m agoHN ↗

Usually IEEE floats have an implied 1 in the front. So for the standard represented numbers, there's some minimum number 1.bbbbbb.. * 2^-N. This allows 1bit more precision than is actually stored.

between any two numbers, there's basically the same epsilon difference, but from the smallest number to zero it's bigger.

A subnormal number breaks that convention, it just becomes 0.bbbbb... * 2^-N. As the numbers get smaller, the relative difference between the numbers gets larger. That also means their precision is smaller than the normal floats.

17m agoHN ↗

This has been the case since a zillion years, since the Core 2 Duo days at minimum.

10m agoHN ↗

The interesting part is that this seems to be Intel-specific.