3 ms·
The end of the post alludes to part 2 ("how to adapt nd_print into something which can behave like the %e, %f, and %g formats of sprintf"), which alas I've yet
by corsix 9y ago
The end of the post alludes to part 2 ("how to adapt nd_print into something which can behave like the %e, %f, and %g formats of sprintf"), which alas I've yet to get around to writing. There'll also be at least one more part after that detailing the bag of performance tricks which can be used to turn the described algorithm into something very competitive. Alternatively, you can jump to the conclusion by just reading the implementation I wrote for LuaJIT [1], though obviously that won't give you the narrative of _why_ things are the way they are.
[1] https://github.com/LuaJIT/LuaJIT/blob/cf2dfaf3b4eef9b2de32d3be962b0336c3fe7dd1/src/lj_strfmt_num.c https://github.com/LuaJIT/LuaJIT/blob/cf2dfaf3b4eef9b2de32d3...