[Numpy-discussion] Oddity with numpy.int64 integer division

Robert Kern robert.kern@gmail....
Tue Apr 24 16:08:11 CDT 2007


Christian Marquardt wrote:
> Restore the invariant, and follow python.
> 
> This
> 
>    >>> -5 // 6
>    -1
> 
> and
> 
>    >>> array([-5])[0] // 6
>    0
> 
> simply doesn't make sense - in any language, you would expect that
> all basic operators provide you with the same same answer when
> applied to the same number, no?

Not if they are different types, you don't, e.g. -5.0 / 6 .

-- 
Robert Kern

"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 mailing list