New submission from Mark Dickinson <dicki...@gmail.com>: Currently, Python switches from %f to %g formatting at 1e50. This applies both to the old-style percent formatting, and to the newer PEP 3101-style formatting:
>>> '%f' % 2.**166 '93536104789177786765035829293842113257979682750464.000000' >>> '%f' % 2.**167 '1.87072e+50' >>> format(2.**166, 'f') '93536104789177786765035829293842113257979682750464.000000' >>> format(2.**167, 'f') '1.87072e+50' The main reason for the switch seems to have been implementation convenience: it makes it possible to use a fixed-size buffer in the float formatting routines. I propose removing this feature for Python 3.1, but leaving it in place for 2.7. See http://mail.python.org/pipermail/python-dev/2009-April/089030.html for additional discussion. ---------- assignee: marketdickinson components: Interpreter Core messages: 86693 nosy: eric.smith, marketdickinson priority: high severity: normal stage: needs patch status: open title: Remove implicit '%f' -> '%g' switch from float formatting. type: feature request versions: Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5859> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com