[Numpy-discussion] What type should / return in python 3k when applied to two integer types?

Charles R Harris charlesr.harris at gmail.com
Thu Aug 27 15:43:33 EDT 2009


On Thu, Aug 27, 2009 at 1:27 PM, Robert Kern <robert.kern at gmail.com> wrote:

> On Thu, Aug 27, 2009 at 11:24, Charles R
> Harris<charlesr.harris at gmail.com> 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 [1]: x = ones(1, dtype=uint64)

In [2]: y = ones(1, dtype=int64)

In [3]: floor_divide(x,y).dtype
Out[3]: dtype('float64')

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090827/bb7c4a8a/attachment.html>


More information about the NumPy-Discussion mailing list