[New-bugs-announce] [issue5859] Remove implicit '%f' -> '%g' switch from float formatting.

Mark Dickinson report at bugs.python.org
Mon Apr 27 22:50:04 CEST 2009

New submission from Mark Dickinson <dickinsm at 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
>>> '%f' % 2.**167

>>> format(2.**166, 'f')
>>> format(2.**167, 'f')

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.



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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list