[ python-Bugs-1490688 ] %g incorrect conversion

SourceForge.net noreply at sourceforge.net
Thu May 18 06:31:54 CEST 2006


Bugs item #1490688, was opened at 2006-05-18 04:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1490688&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: paul rubin (phr)
Assigned to: Nobody/Anonymous (nobody)
Summary: %g incorrect conversion

Initial Comment:
According to
http://docs.python.org/lib/typesseq-strings.html

%g is the same as %f or %e depending on the exponent. 
Test:

Python 2.4.1 (#1, May 16 2005, 15:19:29)
[GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2

>>> x=.123999
>>> '%.4f'%x
'0.1240'
>>> '%.4g'%x
'0.124'
>>>

These are not the same.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1490688&group_id=5470


More information about the Python-bugs-list mailing list