[Numpy-discussion] Possible bug: uint64 + int gives float64

Sturla Molden sturla@molden...
Sun Jun 13 11:30:48 CDT 2010

Den 13.06.2010 18:19, skrev Charles R Harris:
> 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.

As I see it, the 'correct' solution would be coercion to an arbitrarily 
long integer, such as 'long' in Python 2 and 'int' in Python 3.


More information about the NumPy-Discussion mailing list