https://dl.acm.org/doi/10.1145/3192366.3192369 (PLDI 2018 paper)
https://github.com/ulfjack/ryu (C source code)
https://dl.acm.org/doi/10.1145/3192366.3192369 (PLDI 2018 paper)
https://github.com/ulfjack/ryu (C source code)
Also it seems that Ryu prints some numbers in weird ways even though "nicer" representations exist: https://github.com/rust-lang/rust/issues/52811#issuecomment-...
My guess is that smaller y values indicate proportionally faster executions.
[0] http://www.fox-toolkit.org/ New, faster, and often more accurate floating point to string conversion. No, this is not based on Ryu paper. New method reliably generates 16 digits, and does much better rounding.
[1] https://github.com/gogglesguy/fox/blob/77396c6/lib/fxprintf....
[2] [PDF] http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf
The first thing I notice is this comment in a later changelog:
> I believe we have a very fast numerical conversion that appears to be reliably generating about 15 to 16 digits out output [last digit may be off by 1 or 2 in typical case].
If the last digit of a fifteen- to sixteen-digit output is off by one or two, are we sure it round trips?
Second, the test coverage for this feature in tests/format.cpp looks pretty sparse, and it's not obvious to me how the output is verified.
Interesting find. I may play around with this later.
Edit: I tried the test cases from here:
https://www.exploringbinary.com/the-shortest-decimal-string-...
Here's the result:
format="%.30g" output="0.1"
format="%.30g" output="50388143.06823721984"
format="%.30g" output="54167628.18"
format="%.30g" output="9161196241250.051072"
The first and third cases output the correct string. The second case outputs nineteen digits, instead of seventeen, and does not round trip (i.e., it rounded incorrectly). The last case outputs nineteen digits instead of fifteen, but does round trip.