Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. I Built Non-Autoregressive Decision Models with RL a Year Ago(convaiinnovations.com ↗)
    151comments
  2. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    506comments
  3. Human brain is two separate organs, Stanford Medicine-led research finds(stanford.edu ↗)
    188comments
  4. A graphical desktop for the ZX Spectrum(github.com/mindbox77 ↗)
    75comments
  5. Tin: full-text search for Postgres(planetscale.com ↗)
    48comments
  6. “The Secret Life of Circuits” is here(coredump.cx ↗)
    56comments
  7. Asking Authors About Their Own Papers(medium.com/tmlrorg ↗)
    45comments
  8. Supabase (YC S20) Is Hiring for OrioleDB(supabase.link ↗)
    discuss
  9. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    562comments
  10. Black Holes or Black Hole Stars? Astronomers Spar over 'Little Red Dots'(quantamagazine.org ↗)
    17comments
  11. New evidence for hidden chambers beyond Tutankhamun's tomb(nature.com ↗)
    10comments
  12. GPT-6 Astra Solves a WWI German Radio Cipher(prinzai.com ↗)
    137comments
  13. San Francisco Onion Futures Company(onionfutures.com ↗)
    123comments
  14. What Zig felt like, coming from Rust(besok.github.io ↗)
    122comments
  15. Almost Never Use AI to Write Anything Substantive(erichgrunewald.substack.com ↗)
    11comments
  16. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    199comments
  17. Cloudflare Quick Tunnels(cloudflare.com ↗)
    301comments
  18. How to Write with an LLM(sockpuppet.org ↗)
    362comments
  19. Adventures in Microcontroller Circuit Debugging(bigmessowires.com ↗)
    1comments
  20. You can run Git on object storage if you re-make packfiles(tigrisdata.com ↗)
    27comments
  21. Communication by means of modulated Johnson noise(pnas.org ↗)
    20comments
  22. Saving another 100TB of RAM(cloudflare.com ↗)
    93comments
  23. SDCC – Small Device C Compiler(sourceforge.net ↗)
    25comments
  24. Ray Ozzie and the Optimism of Being Early(reproof.app ↗)
    14comments
  25. Science Is Open Software(jepedersen.dk ↗)
    51comments
  26. Why building a Rust LSP is hard(rust-glancer.github.io ↗)
    49comments
  27. OpenJev(openjev.com ↗)
    281comments
  28. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    126comments
  29. Ctenophores: Wonders of Biology(quantamagazine.org ↗)
    9comments
  30. How OpenAI Used Its Own LLMs to Design Its Jalapeño Chip(ieee.org ↗)
    123comments

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