[Numpy-discussion] Type conversion weirdness in numpy-1.0.2.win32-py2.4 binary

Martin Spacek numpy at mspacek.mm.st
Tue May 8 02:30:41 EDT 2007


In linux and win32 (numpy 1.0.1 release compiled from source, and
1.0.3dev3726 respectively), I get the following normal behaviour:

>>> import numpy as np
>>> np.array([1.0, 2.0, 3.0, 4.0])
array([ 1.,  2.,  3.,  4.])
>>> np.int32(np.array([1.0, 2.0, 3.0, 4.0]))
array([ 1,  2,  3,  4])

But on three separate Windows machines running the binary
numpy-1.0.2.win32-py2.4 install, I get this:

>>> import numpy as np
>>> np.array([1.0, 2.0, 3.0, 4.0])
array([ 1.,  2.,  3.,  4.])
>>> np.int32(np.array([1.0, 2.0, 3.0, 4.0]))
31195176
>>> np.int32(np.array([1.0, 2.0, 3.0, 4.0]))
30137880
>>> np.int32(np.array([1.0, 2.0, 3.0, 4.0]))
31186080
>>> np.int32(np.array([1.0, 2.0, 3.0, 4.0]))
31186080
>>> np.float64(np.array([1.0, 2.0, 3.0, 4.0]))
2.1359481850412033e-314
>>> np.int32(np.array([1, 2, 3, 4]))
28729424

One of them was running the numpy-1.0.1 binary, which showed normal
behaviour, until I upgraded it to 1.0.2.

Test come out fine:

>>> np.test()
  Found 5 tests for numpy.distutils.misc_util
  Found 31 tests for numpy.core.numerictypes
  Found 32 tests for numpy.linalg
  Found 4 tests for numpy.lib.index_tricks
  Found 4 tests for numpy.core.scalarmath
  Found 9 tests for numpy.lib.arraysetops
  Found 42 tests for numpy.lib.type_check
  Found 198 tests for numpy.core.multiarray
  Found 3 tests for numpy.lib.getlimits
  Found 36 tests for numpy.core.ma
  Found 2 tests for numpy.lib.polynomial
  Found 1 tests for numpy.fft.fftpack
  Found 13 tests for numpy.lib.twodim_base
  Found 10 tests for numpy.core.defmatrix
  Found 13 tests for numpy.core.umath
  Found 1 tests for numpy.lib.ufunclike
  Found 4 tests for numpy.ctypeslib
  Found 43 tests for numpy.lib.function_base
  Found 9 tests for numpy.core.records
  Found 59 tests for numpy.core.numeric
  Found 3 tests for numpy.fft.helper
  Found 48 tests for numpy.lib.shape_base
  Found 0 tests for __main__
...............................................................................................................
...............................................................................................................
...............................................................................................................
...............................................................................................................
...............................................................................................................
...............
----------------------------------------------------------------------
Ran 570 tests in 1.125s

OK
<unittest.TextTestRunner object at 0x0114B810>
>>> numpy.version.version
'1.0.2'

I'm running python 2.4.4 in all cases (except 2.4.3 on linux). Is this a
problem with the numpy-1.0.2.win32-py2.4 binary? I could try building a
new 1.0.2 binary, if that would help.

Martin



More information about the NumPy-Discussion mailing list