3 ms·
> How to calculate this “shortest unambiguous string” efficiently is more tricky than you might expect. In fact the best known algorithm for calculating it was
by TazeTSchnitzel 11y ago
> How to calculate this “shortest unambiguous string” efficiently is more tricky than you might expect. In fact the best known algorithm for calculating it was published only in 2010, in the paper Printing Floating-Point Numbers Quickly and Accurately with Integers
That's no longer the state-of-the-art. The latest approach - and possibly the end of the road for research her - is Andrysco et al.: http://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pdf http://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pdf
It's been on the front page previously: https://news.ycombinator.com/item?id=10915182 https://news.ycombinator.com/item?id=10915182
- haberman 11y agoThanks for letting me know -- I'll update the article!
- StefanKarpinski 11y agoThe Andrysco et al. paper and algorithm is excellent. The only obvious improvement would be, in cases where there is more than one shortest unambiguous string, printing the one which is closest to the true floating-point value, which I don't believe the Errol algorithm does. But that's getting into serious hair-splitting territory.