[Numpy-tickets] [NumPy] #598: incorrect behaviour with ( "%d"%a[i]) on uint64
NumPy
numpy-tickets@scipy....
Mon Oct 22 17:59:08 CDT 2007
#598: incorrect behaviour with ( "%d"%a[i]) on uint64
--------------------------+-------------------------------------------------
Reporter: gregsmith_to | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: Other | Version: 1.0.2
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
{{{
#!python
>>> a
array([18446744073709551615, 18446744073709551615], dtype=uint64)
>>> "%d" % a[0]
'-1'
>>> "%u" % a[0]
'-1'
>>> "%x" % a[0]
'-1'
}}}
This occurs on 64 and 32 bit machines. Sorry for posting against an older
version, can't find a ticket for this issue though. It used to be that
hex(a[0]) would give you '-0x1' here, but that was fixed by 1.02 whilst
this remains.
Workaround: "%d" % long(a[0]) or "%s" % a[0]
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/598>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list