[pypy-dev] Re: Nice floats

Michael Hudson mwh at python.net
Tue Nov 22 10:33:11 CET 2005


Christian Tismer <tismer at 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...
>
> http://labix.org/python-nicefloat

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




More information about the Pypy-dev mailing list