[python-sg] float to str conversions

Senthil Kumaran senthil at uthcode.com
Mon Jul 4 05:41:37 CEST 2011


For your tech reading pleasure.

On Wed, Jun 29, 2011 at 09:48:42AM +0000, Michael Foord wrote:
> 
> 
> Wondered if you guys had heard of some recent advances in the state
> of the art in this field. I'm sure you have, but thought I'd link it
> here anywhere.
> 
> Quote taken from this article (which links to relevant papers):
> 
> http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/
> 
> In 2010, Florian Loitsch published a wonderful paper in PLDI,
> "Printing floating-point numbers quickly and accurately with
> integers", which represents the biggest step in this field in 20
> years: he mostly figured out how to use machine integers to perform
> accurate rendering! Why do I say "mostly"? Because although
> Loitsch's "Grisu3" algorithm is very fast, it gives up on about 0.5%
> of numbers, in which case you have to fall back to Dragon4 or a
> derivative.
> 
> If you're a language runtime author, the Grisu algorithms are a big
> deal: Grisu3 is about 5 times faster than the algorithm used by
> printf in GNU libc, for instance. A few language implementors have
> already taken note: Google hired Loitsch, and the Grisu family acts
> as the default rendering algorithms in both the V8 and Mozilla
> Javascript engines (replacing David Gay's 17-year-old dtoa code).
> Loitsch has kindly released implementations of his Grisu algorithms
> as a library named double-conversion.
> 


More information about the python-sg mailing list