Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Laya the open source version of Jev(convaiinnovations.com ↗)
    33comments
  2. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    144comments
  3. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    298comments
  4. “The Secret Life of Circuits” is here(coredump.cx ↗)
    31comments
  5. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    500comments
  6. GPT-6 Astra Solves a WWI German Radio Cipher(prinzai.com ↗)
    103comments
  7. San Francisco Onion Futures Company(onionfutures.com ↗)
    88comments
  8. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    139comments
  9. Communication by means of modulated Johnson noise(pnas.org ↗)
    12comments
  10. From Stonemasons to Carpenters(thelastsoftwareengineer.substack.com ↗)
    3comments
  11. Cloudflare Quick Tunnels(cloudflare.com ↗)
    294comments
  12. How to Write with an LLM(sockpuppet.org ↗)
    352comments
  13. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    21comments
  14. SDCC – Small Device C Compiler(sourceforge.net ↗)
    20comments
  15. Ray Ozzie and the Optimism of Being Early(reproof.app ↗)
    2comments
  16. Saving another 100TB of RAM(cloudflare.com ↗)
    86comments
  17. Science Is Open Software(jepedersen.dk ↗)
    45comments
  18. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    103comments
  19. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    42comments
  20. NASA-IBM Lunar Foundation open-Source Geospatial AI Model(usra.edu ↗)
    5comments
  21. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    6comments
  22. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    113comments
  23. OpenJev(openjev.com ↗)
    273comments
  24. Goroutine Leak Profiles(go.dev ↗)
    6comments
  25. Show HN: I wrote a custom assembler for CHIP-8 in C++(github.com/tackx ↗)
    3comments
  26. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    89comments
  27. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    76comments
  28. Veronese's Dogs(publicdomainreview.org ↗)
    2comments
  29. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    94comments
  30. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    16comments

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