[Review request] Floating point formatting


#1

While it is not (yet) strictly a part of Rust, rust-strconv has been my major driving force towards a correct and fast floating point formatting, and I hope to make this into a proper pull request in the future. This issue has been known for a long time (#6220, #7030, #19218, and most recently, #23150).

Recently I’ve completed the absolute minimum of the required algorithms: Shortest and exact variants of Dragon4 and Grisu3. [1] Unfortunately, unlike Dragon4 which I understand fully, I’m less certain about the correctness of Grisu3. The crate has a fine amount of tests derived from multiple sources (and f32 shortest case is fully checked for equivalence), but the sheer amount of underlying logics made me hard to declare the completion. Prior to the potential PR (I do accept suggestions on this too!), I’d like to be reviewed about the very implementation.

[1] The fixed (“print digits up to N digits after the decimal point”) variant can be implemented via an approximate logarithm calculation and the exact (“print exactly N significant digits”) variant.