[issue4482] 10e667.__format__('+') should return 'inf'

Mark Dickinson report at bugs.python.org
Thu Apr 23 00:46:09 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

> Maybe if you explicitly ask for the "sign" of a NaN, it should
> always be a space.

Actually, I think '+nan' for format(float('nan'), '+'), and ' nan'
for format(float('nan'), ' ').  Then nans and infs can be treated 
identically, except that the sign of a nan is always considered to be 
positive, regardless of what the _Py_dg_dtoa function returns.

> And when requesting leading zeros, you also get leading spaces
> instead?

Should do the same thing for nans and infs here.  But certainly leading 
zeros should be avoided.  Leading spaces sounds fine to me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4482>
_______________________________________


More information about the Python-bugs-list mailing list