On Thu, 26 Apr 2007 21:35:03 +0300, Sergiy <[EMAIL PROTECTED]> wrote:
>print 1 / 2
>print -1 / 2
>
>0
>-1
>
>correct?

  Quoting http://www.python.org/doc/lib/typesnumeric.html:

(1)
    For (plain or long) integer division, the result is an integer.
The result is always rounded towards minus infinity: 1/2 is 0, (-1)/2
is -1, 1/(-2) is -1, and (-1)/(-2) is 0. Note that the result is a long
integer if either operand is a long integer, regardless of the numeric
value.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list
  • wtf Sergiy
    • Re: wtf Jean-Paul Calderone
    • Re: wtf Shane Hathaway

Reply via email to