Converting Binary Floating-Point Numbers to Shortest Decimal Strings: An Experimental Review
Ja\"el Champagne Gareau, Daniel Lemire

TL;DR
This paper empirically compares various algorithms for converting binary floating-point numbers to shortest decimal strings across different hardware, highlighting performance differences and potential optimization avenues.
Contribution
It provides a comprehensive experimental review of conversion algorithms, benchmarking their speed and output length across multiple architectures and identifying areas for improvement.
Findings
Schubfach and Dragonbox outperform older algorithms in speed.
Many implementations do not produce the shortest possible strings.
Standard library functions are significantly slower than specialized algorithms.
Abstract
When sharing or logging numerical data, we must convert binary floating-point numbers into their decimal string representations. For example, the number might become 3.1415927. Engineers have perfected many algorithms for producing such accurate, short strings. We present an empirical comparison across diverse hardware architectures and datasets. Cutting-edge techniques like Schubfach and Dragonbox achieve up to a tenfold speedup over Steele and White's Dragon4, executing as few as 210 instructions per conversion compared to Dragon4's 1500-5000 instructions. Often per their specification, none of the implementations we surveyed consistently produced the shortest possible strings-some generate outputs up to 30% longer than optimal. We find that standard library implementations in languages such as C++ and Swift execute significantly more instructions than the fastest methods, with…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNumerical Methods and Algorithms · Algorithms and Data Compression · Cryptography and Residue Arithmetic
