[Numpy-discussion] uint64 typecasting with scalars broken (?)
Mon Apr 23 20:44:20 CDT 2007
Christian Marquardt wrote:
> The following is what I expected...
> >>> y = 1234
> >>> x = array(, dtype = "uint64")
> >>> print x + y, (x + y).dtype.type
>  <type 'numpy.uint64'>
This is "what you expect" only because y is a scalar and cannot
determine the "kind" of the output.
> but is this the way it should be? (numpy 1.0.2, Linux, Intel comilers)
> >>> print x + y, type(x + y)
> 1235.0 <type 'numpy.float64'>
This is correct (sort of) because in a mixed operation between uint64
and int32, because there is no int128, the sum must be placed in a
float. In reality it should be a long-double float but it was decided
not to perpetuate long double floats like this because then on 64-bit
platforms they would be showing up everywhere.
More information about the Numpy-discussion