[Numpy-discussion] More complex issues

Tim Leslie tim.leslie at gmail.com
Mon Jan 8 22:31:10 EST 2007

Hi all,

Sorry for the bad pun, but I'm getting myself confused trying to
understand the expected behaviour of how complex values are handled
throughout numpy. My current confusion is to do with the difference
between how <type 'complex'> and <type 'numpy.complex128'> are
handled. If someone could explain this difference that would be great.



In [45]: z = N.complex128(1 + 2j)

In [46]: N.float64(z)
Out[46]: 1.0

In [47]: N.float64(1 + 2j)
exceptions.TypeError                                 Traceback (most
recent call last)

/home/timl/src/scipy/Lib/linsolve/<ipython console>

TypeError: can't convert complex to float; use abs(z)

More information about the NumPy-Discussion mailing list