[Numpy-discussion] Rationale for integer promotion rules
robert.kern at gmail.com
Thu Jul 16 14:19:58 EDT 2015
On Thu, Jul 16, 2015 at 7:14 PM, Nathaniel Smith <njs at pobox.com> wrote:
> On Thu, Jul 16, 2015 at 9:18 AM, Antoine Pitrou <solipsis at pitrou.net>
> > while adding int8 and uint8 will give int16 as result
> > (promoting to the smallest fitting type).
> I understand this to be a consequence of the previous rule (results
> should match inputs) combined with the need to find a common input
Specifically, when combining signed and unsigned ints, we need to find a
signed int type that can simultaneously hold both of the *inputs*. Whether
the *output* would fit or overflow is not what the rules are concerned with.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion