Re: Integer math question
"Dan Bishop" <danb_83@yahoo. com> wrote in message
news:ad052e5c.0 401041659.68460 bd@posting.goog le.com...[color=blue]
> It's a feature. The advantage of defining x // y as floor(x / y) is
> that x % y is always nonnegative.[/color]
Sorry, but x%y can be negative in Python:
[color=blue][color=green][color=darkred]
>>> x, y = 5, -10
>>> x%y[/color][/color][/color]
-5
"Dan Bishop" <danb_83@yahoo. com> wrote in message
news:ad052e5c.0 401041659.68460 bd@posting.goog le.com...[color=blue]
> It's a feature. The advantage of defining x // y as floor(x / y) is
> that x % y is always nonnegative.[/color]
Sorry, but x%y can be negative in Python:
[color=blue][color=green][color=darkred]
>>> x, y = 5, -10
>>> x%y[/color][/color][/color]
-5
Comment