Integer math question
sross at connectmail.carleton.ca
Sat Jan 3 21:20:01 CET 2004
"Rainer Deyke" <rainerd at eldwood.com> wrote in message
news:kTEJb.724242$HS4.5376202 at attbi_s01...
> Sean Ross wrote:
> > a = bq + r and 0<=r<b 
> But 0 <= r < b is a contradiction when b < 0.
> Rainer Deyke - rainerd at eldwood.com - http://eldwood.com
>>> a = 5
>>> b = -10
>>> q,r = divmod(a,b)
Here, the division algorithm does not apply (b is a negative integer).
Perhaps there's some other theorem for this case?
b<r<=0, when b < 0? I don't know.
More information about the Python-list