curious problem with large numbers
Scott David Daniels
Scott.Daniels at Acm.Org
Fri Apr 8 14:21:46 EDT 2005
Scott David Daniels wrote:
> Bengt Richter wrote:
>
>>> Aha! Same version (2.3.4):
>>>
>>> Idle:
>>> >>> 1e10000
>>> 1.0
>>> >>> import struct; struct.pack('d', 1e10000)
>>> '\x00\x00\x00\x00\x00\x00\xf0?'
>>> (which is actually 1.0)
>>>
>>> python via command line (readline support):
>>> >>> 1e10000
>>> 1.#INF
>>> >>> import struct; struct.pack('d', 1e10000)
>>> '\x00\x00\x00\x00\x00\x00\xf0\x7f'
>>>
>>> Same results (command line vs. Idle) for 2.4.1.
On Python 2.2.3: (#42, Jun 4 2003, 10:33:42)
IDLE 0.8 -- press F1 for help
>>> 1e1000
1.#INF
So, sometime after that.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list