[Numpy-discussion] Odd numerical difference between Numpy 1.5.1 and Numpy > 1.5.1

Charles R Harris charlesr.harris at gmail.com
Tue Apr 12 14:17:37 EDT 2011


On Tue, Apr 12, 2011 at 11:56 AM, Robert Kern <robert.kern at gmail.com> wrote:

> On Tue, Apr 12, 2011 at 12:27, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
>
> > IIRC, the behavior with respect to scalars sort of happened in the code
> on
> > the fly, so this is a good discussion to have. We should end up with
> > documented rules and tests to enforce them. I agree with Mark that the
> tests
> > have been deficient up to this point.
>
> It's been documented for a long time now.
>
> http://docs.scipy.org/doc/numpy/reference/ufuncs.html#casting-rules
>
>
Nope, the kind stuff is missing. Note the cast to float32 that Mark pointed
out. Also that the casting of python integers depends on their sign and
magnitude.

In [1]: ones(3, '?') + 0
Out[1]: array([1, 1, 1], dtype=int8)

In [2]: ones(3, '?') + 1000
Out[2]: array([1001, 1001, 1001], dtype=int16)


Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110412/f3adf293/attachment.html>


More information about the NumPy-Discussion mailing list