[Numpy-discussion] Bug or feature ?
jmiller at stsci.edu
Mon Jan 24 07:31:24 CST 2005
On Mon, 2005-01-24 at 16:15 +0100, Jean-Luc Menut wrote:
> > numarray and Numeric, consciously, don't work that way. So, no, you
> > can't expect that.
> > rank-0 yes, silent truncation no.
> I'm sorry, I don't understand very well what is a silent truncation.
By silent truncation, I mean the fact that 1.1 is floored to 1 without
an exception or warning.
> When I write :
> >> a = array([[1, 2],[3, 4]])
> >> >>> a[0,0]=1.1
> I cannot expect to have a = array([[1.1, 2],[3, 4]]) ?
This works and the result will be a Float64 array containing 1.1,
> How can I solve this problem ? is it possible to force an array to be an
> array of float ?
Sure. For numarray or Numeric:
a = array([[1, 2],[3, 4]], typecode=Float64)
More information about the Numpy-discussion