Uses ruby form to make Ryu representation more human readable.
Example:
3.0000000000000004e-1 should be just 0.30000000000000004
done
@9il sorry if this isn't the right place to ask, but I'd like to make progress on integrating ryu in nim's stdandard library (refs https://github.com/nim-lang/Nim/issues/13365), and I'm wondering what's the best way forward, that doesn't compromise on performance; let's say for now only 32 and 64 bit is needed.
Do you have a link to benchmarks comparing performance for libmir's ryu vs C implementation from https://github.com/ulfjack/ryu/tree/master/ryu?
Given the similarities between nim and D, would you recommend porting libmir's version to nim, or starting "from scratch" from C's version?
Note also that C interop is possible in nim too so that could be a potential alternative if the dependencies involved are small.
What do you think of quality of implementation of these nim ports https://github.com/disruptek/ryu and https://github.com/Clyybber/nimryu (there's also https://github.com/alaviss/nim-ryu but it's not intended for performance, rather for correctness, say to test an implementation)? I'm specifically interested in an implementation that wouldn't compromise on performance (and simplicity of implementation as secondary criterion)
Thanks!
@timotheecour I didn't make benchmarks. Mir generic version is derived from original generic 128-bit algorithm. Few CTFE optimisations were added for 32 and 64 bit floats. It definitely much faster than original 128 bit. Likely original specialised 32 and 64 bit algorithms would be faster than Mir, not very significant I think, maybe 5-20%, I don't know.
What do you think of quality of implementation of these nim ports https://github.com/disruptek/ryu and https://github.com/Clyybber/nimryu (there's also https://github.com/alaviss/nim-ryu but it's not intended for performance, rather for correctness, say to test an implementation)? I'm specifically interested in an implementation that wouldn't compromise on performance (and simplicity of implementation as secondary criterion)
I can't say, it requires time to review all the code. The most important note I think: one can't use 64 bit Ryu for 32 bit numbers, that wouldn't work, needs 32 bit Ryu for 32 bit numbers. 128 bit ryu can be used for 128, 80, 64, and 32 bit numbers because it is generic. C code is pretty good, it doesn't have deps if I remember correctly.