[Python-Dev] Floor division

Armin Rigo arigo at tunes.org
Sat Jan 20 12:29:34 CET 2007


Hi Tim,

On Fri, Jan 19, 2007 at 08:33:23PM -0500, Tim Peters wrote:
> >>> decimal.Decimal(-1) % decimal.Decimal("1e100")
> Decimal("-1")

BTW - isn't that case in contradiction with the general Python rule that
if b > 0, then a % b should return a number between 0 included and b
excluded?  We try hard to do that for ints, longs and floats.  The fact
that it works differently with Decimal could be unexpected.


A bientot,

Armin


More information about the Python-Dev mailing list