[Numpy-discussion] how to use ldexp?

Pauli Virtanen pav@iki...
Thu May 21 04:41:06 CDT 2009

Thu, 21 May 2009 09:26:18 +0000, Pauli Virtanen wrote:

> Thu, 21 May 2009 01:45:54 -0700, dmitrey wrote:
>> I have updated numpy to latest '1.4.0.dev7008', but the bug still
>> remains.
>> I use KUBUNTU 9.04, compilers - gcc (using build-essential), gfortran.
> Worksforme on Ubuntu 9.04, on python2.6 and python2.5. Should be the
> same platform.

This was on 32-bit machine. I can reproduce this on a 64-bit platform, 
current SVN head:

>>> np.ldexp(5, 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: function not supported for these types, and can't coerce 
safely to supported types
>>> np.ldexp(5, np.int32(2))
>>> np.ldexp.types
['fi->f', 'di->d', 'gi->g']

So for some reason the second argument tries to cast Python int to int64, 
and there's no loop to handle this.

Pauli Virtanen

More information about the Numpy-discussion mailing list