[Numpy-discussion] What type should / return in python 3k when applied to two integer types?
Thu Aug 27 14:46:33 CDT 2009
On Thu, Aug 27, 2009 at 12:43, Charles R
> On Thu, Aug 27, 2009 at 1:27 PM, Robert Kern <email@example.com> wrote:
>> On Thu, Aug 27, 2009 at 11:24, Charles R
>> Harris<firstname.lastname@example.org> wrote:
>> > I'm thinking double. There is a potential loss of precision for 64 bit
>> > ints
>> > but nothing else seems reasonable for a default. Thoughts?
>> Python int / Python int => Python float
>> no matter how many decimal places the two ints have. I also say double.
> What about //?
> In : x = ones(1, dtype=uint64)
> In : y = ones(1, dtype=int64)
> In : floor_divide(x,y).dtype
> Out: dtype('float64')
Ewww. It should be an appropriate integer type. Probably whatever x*y is.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion