Well that's fine for binops with the same types, but it's not so
obvious which type to cast to when mixing signed and unsigned types.
Should the type of N.int32(10)+N.uint32(10) be int32, uint32 or int64?
Given your answer what should the type of N.int64(10)+N.uint64(10) be
(which is the case in the bug)?
The current casting rules for the unsigned + signed integral types in
numpy seems to be:
int32 uint32 int64 uint64
int32 int32 int64 int64 float64
uint32 uint32 int64 uint64
int64 int64 float64
uint64 uint64
This does seem slightly barmy in cases. For reference here is what C uses:
int32 uint32 int64 uint64
int32 int32 uint32 int64 uint64
uint32 uint32 uint64 uint64
int64 int64 uint64
uint64 uint64
So numpy currently seems to prefer to keep sign preserved and extends
the width of the result when it can. C prefers to keep overflows
minimized and never extends the width of the result.
James