![](https://secure.gravatar.com/avatar/7b53b3559206e2821b46359d057c8bd9.jpg?s=120&d=mm&r=g)
Hi pypy-dev, I just stumbled oversome code from Gustavo. I think we were considering doing exact float formatting. I wrote something that works. But if we like to have it, this implementation gives the shortest possible representation. At some cost, of course... http://labix.org/python-nicefloat -- Christian Tismer :^) <mailto:tismer@stackless.com> tismerysoft GmbH : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/
![](https://secure.gravatar.com/avatar/1efc90ff6075b7654d8a8ce6e51a2cd3.jpg?s=120&d=mm&r=g)
Christian Tismer <tismer@stackless.com> writes:
Hi pypy-dev,
I just stumbled oversome code from Gustavo. I think we were considering doing exact float formatting. I wrote something that works. But if we like to have it, this implementation gives the shortest possible representation.
At some cost, of course...
This is the same algorithm I implemented in lib/_float_formatting.py ages and ages ago... It's not RPython as it uses long arithmetic, but only boundedly so (I don't think it will use a number larger than 2**53) so you could probably fake it by using a pair of ints. The problem with _float_formatting is that I never got around to implementing the fixed formatting routines from the same paper (and Gustavo hasn't either, AFAIK). Cheers, mwh --
I wouldn't want to live without readline, but some of the things it does call for the application of thumbscrews. -- me on python-dev
participants (2)
-
Christian Tismer
-
Michael Hudson