Message60684
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) |
|
Date |
User |
Action |
Args |
2008-01-20 09:57:35 | admin | link | issue1153226 messages |
2008-01-20 09:57:35 | admin | create | |
|