On Sun, Jun 13, 2010 at 9:20 AM, Pearu Peterson <pearu.peter...@gmail.com>wrote:
> On Sun, Jun 13, 2010 at 4:45 PM, Nadav Horesh <nad...@visionsense.com> > wrote: > > int can be larger than numpy.int64 therefore it should be coerced to > float64 (or float96/float128) > > Ok, I see. The results type is defined by the types of operands, not > by their values. I guess > this has been discussed earlier but with small operands this feature > may be unexpected. > For example, with the same rule the result of int64 + int should be > float64 while currently > it is int64. > > It's the combination of unsigned with signed that causes the promotion. The int64 type can't hold the largest values in uint64. Strictly speaking, doubles can't hold either of the 64 bit integer types without loss of precision but at least the degradation is more gradual. Another possibility here would be to raise an error/warning because no suitable integer type is available, that would be perhaps less surprising than the promotion to float. IIRC, there is also a case where numeric arrays get promoted to objects, but I don't see my old table of such things floating about at the moment. Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion