On Tue, Apr 29, 2008 at 12:28 AM, Hoyt Koepke <hoytak@gmail.com> wrote:
Hello,

I have a quick question that I'm hoping will improve my numpy
understanding.  I noticed some behavior when using float64 to convert
a matrix type that I didn't expect:


In [35]: b1 = array([1.0])

In [36]: float64(b1)
Out[36]: 1.0

In [37]: b2 = array([1.0, 2.0])

In [38]: float64(b2)
Out[38]: array([ 1.,  2.])


I didn't expect calling float64 would convert b1 to a scalar. Seems
like an inconsistency.  I assume this is intentional, as someone would
have noticed it a long time ago if not, so could someone explain the
reasoning behind it?  (or point me to a source that will help?)

It's inconsistent and looks like a bug:

In [4]: float32(array([[[1]]]))
Out[4]: array([[[ 1.]]], dtype=float32)

In [5]: float64(array([[[1]]]))
Out[5]: 1.0

Float64 is a bit special because it starts as the python float. Maybe Travis can say what the differences are.

Chuck