[Numpy-tickets] [NumPy] #716: Inconsistent behavior, i686 vs x86_64
NumPy
numpy-tickets@scipy....
Wed Apr 2 14:04:39 CDT 2008
#716: Inconsistent behavior, i686 vs x86_64
---------------------------------+------------------------------------------
Reporter: jamie@goonathon.net | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: 1.0.5
Component: Other | Version: none
Severity: normal | Keywords:
---------------------------------+------------------------------------------
Gentoo, numpy-1.0.4-r2.
Possible related to http://scipy.org/scipy/numpy/ticket/669
Simple example,
{{{
[either i686 or x86_64]
>>> numpy.uint64(418465321) / 8928000
46.871115703405017
>>> numpy.uint32(418465321) / 8928000
46
}}}
Example that actually bit me,
{{{
[i686]
>>> A = numpy.array([1, 2, 3, 4], numpy.uint8)
>>> B = numpy.array([2, 4, 6, 8], numpy.uint8)
>>> C = B - A
>>> S = C.sum()
>>> type(S)
<type 'numpy.uint32'>
>>> L = len(C)
>>> type(L)
<type 'int'>
>>> S/L
2
[x86_64]
>>> A = numpy.array([1, 2, 3, 4], numpy.uint8)
>>> B = numpy.array([2, 4, 6, 8], numpy.uint8)
>>> C = B - A
>>> S = C.sum()
>>> type(S)
<type 'numpy.uint64'>
>>> type(L)
<type 'int'>
>>> S/L
2.5
}}}
Comments:
1) numpy.uint64 / int -> float
numpy.uint32 / int -> int
It seems like these should at least evaluate to the same type.
2) Should .sum() return a numpy.uint64, even on 32-bit platforms,
for the sake of consistency?
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/716>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list