[Python-Dev] floatformat vs float_format

Eric Smith eric at trueblade.com
Thu Jan 1 10:43:36 CET 2009


David Cournapeau wrote:
> Hi,
> 
> In python 2.6, there have been some effort to make float formatting
> more consistent between platforms, which is nice. Unfortunately, there
> is still one corner case, for example on windows:
> 
> print a -> print 'inf'
> print '%f' % a -> print '1.#INF'
> 
> The difference being that in the second case, the formatting is done
> in floatformat.c (in stringobject.c), whereas in the first case, it is
> done in format_float (in floatobject.c). Shouldn't both functions be
> calling the same underlying implementation, to avoid those
> inconsistencies ?

Yes, float formatting definitely needs some rationalization.

While this isn't the exact issue discussed in 
http://bugs.python.org/issue3382, it is related, and Windows is the 
reason I had to back my fix out right before the freeze for 2.6 and 3.0. 
It's on my list of things to fix.

http://bugs.python.org/issue4482 might also be related, and I'll fix 
that, too.

If you could either add a comment to 3382 (with this test case) or open 
another bug and assign it to me (eric.smith), I'd appreciate it.

Happy New Year, all!

Eric.



More information about the Python-Dev mailing list