~/talk

Printing Floating Numbers is Surprisingly Hard!

Talkat CodeLand 2020 · 2020-07-23..07-24· [compilers-and-language-design]
github:gs0510
slides:none on file

Computers represent decimals in binary so 0.1 + 0.2 ≠ 0.3 when printed; IEEE 754 maps many decimals to a single binary value and printing must pick a shortest decimal that roundtrips. The original Dragon4 (1990) is provably correct but uses big‑integer math and is slow. Grisu3 (2013) uses 64‑bit machine integers, is correct about 99.5% of the time and falls back to Dragon4 otherwise, running ~12.5× faster. Ryu (recent) uses only machine integers, skips digits in bulk, and runs ~3× faster than Grisu3; all focus on output, not input.

AI-written summary · about

  1. 0:00Introduction
  2. 1:08Why 0.1 + 0.2 ≠ 0.3
  3. 3:35Floating point basics
  4. 4:37Dragon4 algorithm explained
  5. 8:13Grisu3 vs Dragon4
  6. 11:05Ryu algorithm overview
  7. 13:13Open challenges
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.