[Numpy-discussion] Rationale for integer promotion rules

Sturla Molden sturla.molden at gmail.com
Fri Jul 17 14:16:24 EDT 2015

Matthew Brett <matthew.brett at gmail.com> wrote:

>>>  Furthermore, adding int64
>>> and uint64 returns float64.
>> This is a grievous kluge, on the grounds that no-one is really sure
>> *what* to do in this case.
> It doesn't seem unreasonable to me : casting int64 to uint64 or uint64
> to int64 could lead to disastrous truncation.  float64 can exactly
> represent integers +/- 2**53 and will have some defined relative error
> above that.

We could promote to Python int on Python 3 and long on Python 2. 


More information about the NumPy-Discussion mailing list