> I was just screwing around. > and found: > >>> -1/100 > -1 > Shouldn't it be zero? > 1/100 returns 0 > but -1/ANY_POSITIVE_INTEGER_NUMBER > returns -1 > > >>> -10/3 > -4 > > It behaves correct for positive numbers, but for negative > integers it seems to subtract one from the expected result. > That is the intended behavior. Look at the output of divmod().
>>> divmod(-1,100) (-1,99) Let (q,r) = divmod(d, v) with v > 0, the behavior is chosen so that 0<= r < v. casevh -- http://mail.python.org/mailman/listinfo/python-list