Converting Binary Floating-Point Numbers to Shortest Decimal Strings
onlinelibrary.wiley.com18 points by matt_d 4 days ago
18 points by matt_d 4 days ago
Another contender: Russ Cox's "fast unrounded scaling" [1].
Cox writes: "The main idea of this post is to implement fast unrounded scaling, which computes an approximation to x · 2^e · 10^p, often in a single 64-bit multiplication. On that foundation we can build nearly trivial printing and parsing algorithms that run very fast. In fact, the printing algorithms run faster than all other known algorithms, including Dragon4, Grisu3, Errol3, Ryū, Ryū Printf, Schubfach, and Dragonbox, and the parsing algorithm runs faster than the Eisel-Lemire algorithm. This post presents both the algorithms and a concrete implementation in Go. I expect some form of this Go code to ship in Go 1.27 (scheduled for August 2026)."
zmij[1] is claimed to be significantly faster than all of the tested implementations in the paper. It would have been nice if it was included.
https://github.com/vitaut/zmij/commit/26b4aae7771c52314465d7...
It is three months old, probably created after they submitted for publication.