Should numpy.sqrt(-1) return 1j rather than nan?

Mark Bakker markbak at
Thu Oct 12 02:58:46 CDT 2006

My vote is for consistency in numpy.
But it is unclear what consistency is.

What is truly confusing for newbie Python users (and a source for error even
after 5 years of Python programming) is that

>>> 2/3

In that respect, I would think

>>> numpy.sqrt(2)

should give 1, but it gives 1.4142135623730951

So numpy does typechecking anyway (it gets an integer and makes it a float).

If that is the consistent behavior, then by all means

>>> sqrt(-1)

should return 1j.

Wouldn't that be the consistent thing to do????

-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
-------------- next part --------------
Numpy-discussion mailing list
Numpy-discussion at

More information about the Numpy-discussion mailing list