Formatting floating-point numbers
summary
Converts binary IEEE‑754 to decimal with implementations (Ryu, Dragon, Grisu) and libraries ({fmt}, double‑conversion) and targets C++17 std::to_chars and C++20 std::format. Demonstrated ~10× speedup (about 14× vs iostreams in benchmarks) with similar speed to double‑conversion, produces round‑trip shortest representation by default, is locale‑independent unless opted in, supports zero‑allocation buffering (memory_buffer) and exposes tradeoffs: to_chars needs explicit buffer management and high‑precision tables for worst‑case cases.
AI-written summary · about
chapters (36)
- 0:00Introduction
- 0:37About me
- 1:05What made me interested
- 2:05The abstract
- 2:37History
- 4:03Fortran
- 5:25References
- 6:45Stackoverflow
- 7:39Whats broken
- 8:32Properties
- 10:04No information loss
- 11:19How much digits
- 11:51Generate shortest output
- 12:43Correct rounding
- 13:31Bit layout
- 14:48Example
- 16:59Neighbors
- 17:27Simple observation
- 17:50Finding the largest case
- 21:29Plot predecessor successor
- 24:03Printf
- 25:13Hack digits
- 25:23Dragon
- 26:53Grizzle
- 27:26Ryu
- 28:09Charcoal
- 30:14State Format
- 31:09Empty
- 32:59Lowcalorie independence
- 35:19Fancy beauty print
- 36:09Some characters
- 36:33Alignment
- 36:54Width
- 37:10Presentation
- 42:39Benchmark
- 50:51Questions
related talks
01h 05mThe Many Faces of Number ⟷ String Conversions
01h 00mProcessing Decimal Values
01h 01m“A modern formatting library for C++”
01h 04mBeyond the Floating Point Computations - What’s New, What’s Useful?
50mPlenary: C++ MythBusters
57mProgramming for Warm Days: Avoiding Dangerous Conversions
59mRange-Based Text Formatting - For a Future Range-Based Standard Library
58mThe Surprising Complexity of Formatting Ranges in Cpp
