[ python-Bugs-1153226 ] string interpolation breaks with %d and
large float
SourceForge.net
noreply at sourceforge.net
Mon Feb 28 06:10:29 CET 2005
Bugs item #1153226, was opened at 2005-02-28 15:10
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=1153226&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Stephen Thorne (jerub)
Assigned to: Nobody/Anonymous (nobody)
Summary: string interpolation breaks with %d and large float
Initial Comment:
We have experienced a problem recently when wanting to
render a large float as a string. Converting the float
to an int/long manuall was required.
'%d' % f
throws an exception for all floats f, f >= 2**31
Expected output, shown with 'int()' and 'long()':
>>> '%d %d' % (long(float(2**31)), int(float(2**31)))
'2147483648 2147483648'
Non-Working Example.
>>> '%d' % float(2**31)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: int argument required
Tested on:
Python 2.3.4 (#1, Oct 26 2004, 16:42:40)
Python 2.4.1a0 (#2, Feb 9 2005, 22:42:24)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1153226&group_id=5470
More information about the Python-bugs-list
mailing list