?

Log in

No account? Create an account
 
 
13 October 2005 @ 11:22 pm
Hey, nice float!  
python-nicefloat is a Python module implementing an algorithm based on the paper "Printing Floating-Point Numbers Quickly and Accurately", by Robert G. Burger and R. Kent Dybvig.

The implemented algorithm will find the shortest, correctly rounded output string representing a decimal number that converts to the same internal binary floating-point number when read.

Update: the download link is now fixed.

Have fun!
Tags:
 
 
 
micahel on October 14th, 2005 08:36 am (UTC)
i think i already did this :)
http://codespeak.net/svn/pypy/dist/pypy/lib/_float_formatting.py

Unless you've implemented the fixed format routines as well, in which case PyPy is interested :)

It's a bit hard to tell though as it looks like you forgot to upload the file...
gniemeyer on October 14th, 2005 12:15 pm (UTC)
Re: i think i already did this :)
Hello Michael,

Oops.. sorry about that. The file was there, but the hack I made in moin to show up urls at labix.org/download was broken for page names including '-'. It's fixed now.

I have not implemented the fixed format routines because I was really after the free format one (and you already had it, right? :-), but reading the paper it looks like a small change in the free format one.

If you're looking for it, I may give it a try.
effbot on October 14th, 2005 12:23 pm (UTC)
shouldn't this be in the standard library?
so where's the patch for Lib/repr.py ?

gniemeyer on October 14th, 2005 01:46 pm (UTC)
Re: shouldn't this be in the standard library?
Yes, I think it should. Indeed, I think the standard float.__repr__ should be implemented using that algorithm. Anyway, since it's not, I'll prepare a patch to put it in the stdlib.