Hi,
Is it possible to have a view of a float64 array that is itself float32?
So that:
A = np.arange(5, dtype='d')
A.view(dtype='f')
would return a size 5 float32 array looking at A's data?
Thanks,
--
Hugo Gagnon
___
NumPy-Discussion mailing list
Hi,
Is it possible to have a view of a float64 array that is itself float32?
So that:
A = np.arange(5, dtype='d')
A.view(dtype='f')
would return a size 5 float32 array looking at A's data?
I think not. The memory layout of a 32-bit IEEE float is not a subset of that
of a 64-bit float
I'm not sure if you are referring to rounding errors but that's OK with
me.
I was thinking something along the lines of changing how numpy looks at
the data of A's view by modifying say the stride attribute, etc.
--
Hugo Gagnon
On Wed, Mar 21, 2012, at 11:19, Zachary Pincus wrote:
Hi,
I'm not sure if you are referring to rounding errors but that's OK with
me.
I was thinking something along the lines of changing how numpy looks at
the data of A's view by modifying say the stride attribute, etc.
Yes, so was I. As you can see in my example with ints below, you could skip