Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    110comments
  2. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    149comments
  3. “The Secret Life of Circuits” is here(coredump.cx ↗)
    24comments
  4. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    101comments
  5. GPT-6 Astra Solves a WWI German Radio Cipher(prinzai.com ↗)
    79comments
  6. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    447comments
  7. San Francisco Onion Futures Company(onionfutures.com ↗)
    77comments
  8. Cloudflare Quick Tunnels(cloudflare.com ↗)
    285comments
  9. SDCC – Small Device C Compiler(sourceforge.net ↗)
    20comments
  10. How to Write with an LLM(sockpuppet.org ↗)
    341comments
  11. Communication by means of modulated Johnson noise(pnas.org ↗)
    1comments
  12. Laya the open source version of Jev(convaiinnovations.com ↗)
    1comments
  13. Science Is Open Software(jepedersen.dk ↗)
    40comments
  14. Saving another 100TB of RAM(cloudflare.com ↗)
    83comments
  15. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    18comments
  16. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    93comments
  17. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    32comments
  18. Apple M6 Pro Achieves the Highest Single-Core CPU Score in Geekbench 7(geekbench.com ↗)
    75comments
  19. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    107comments
  20. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    6comments
  21. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    4comments
  22. OpenJev(openjev.com ↗)
    270comments
  23. From Stonemasons to Carpenters(thelastsoftwareengineer.substack.com ↗)
    1comments
  24. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    89comments
  25. Goroutine Leak Profiles(go.dev ↗)
    4comments
  26. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    73comments
  27. Veronese's Dogs(publicdomainreview.org ↗)
    1comments
  28. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    14comments
  29. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    80comments
  30. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    100comments

Rendering floating point numbers is hard

38 pointsby 15y agoserpentine.com
17 comments
15y agoHN ↗

Are logarithmic number systems a better alternative to floats?

15y agoHN ↗

Sometimes. :) They are faster to multiply, divide, exponentiate, and take roots of. But they are a lot harder to add and subtract, and of course it is somewhat less accurate.

15y agoHN ↗

"Grisu3 works on 99.49% of random IEEE doubles."

What a curious benchmark! It makes you wonder all kinds of things like how many IEEE doubles there are; how you sample from them randomly; what kind of coverage of the reals you get; and how relevant it all is.

15y agoHN ↗

IEEE doubles are just 64-bit words; so there are 2^64 and you sample randomly by picking a random 64-bit word.

(There are some subtleties: a "random 64-bit word interpreted as a double" is clearly not uniformly distributed over the reals; x86/amd64 uses 80-bit doubles for intermediate results, except when it doesn't; there are things like subnormals ("really small numbers"), Not-a-Number, Infinity, -Infinity, -0; but the above should give you the right general idea)

15y agoHN ↗

Sure, but to take an extreme example, suppose you have a division operator that fails to check for division-by-zero. Then your operator works in 100 * (1 - 2^63)% of all cases. That gives you 18 nines and sounds pretty convincing but it's hardly the point.

In the same way I'm wondering how meaningful it is to say that an algorithm works for 99.49% of all doubles, sampled uniformly. In other words, how could I use that benchmark to make a judgement about using grisu3?

15y agoHN ↗

Keeping everything in rational form would be nice, and easy to present.

15y agoHN ↗

Needs lazy evaluation. Just don't try to look at the whole number at once.

15y agoHN ↗

the Grisu family acts as the default rendering algorithms in both the V8 and Mozilla Javascript engines (replacing David Gay's 17-year-old dtoa code)

Hmm. I think maybe a weekend hack is in order. Perhaps dtoa in Python can be replaced in a similar fashion, since Python maintains David Gay's algorithm as an upstream source.

http://hg.python.org/cpython/file/fc831c49216d/Python/dtoa.c

EDIT: Looks like there has already been some gripes about the quality of David Gay's implementation.

http://bugs.python.org/issue9009