Q: Feature Wish: "%" Extension

Paul Rubin phr-n2001d at nightsong.com
Sun Nov 4 03:27:53 EST 2001


"Tim Peters" <tim.one at home.com> writes:
> Across decades of integer numeric programming, I can't recall any *use* for
> that identity; but that i%j >= 0 whenever j>0 is endlessly useful, as is
> your identity relating int-div and int-mod.

I did notice that Algorithm X from Knuth vol. 2 for extended GCD
gives negative answers in Python if you code it straight from the book.
It was easy to correct so I didn't analyze it carefully but I think
floor-mod may have had something to do with it.



More information about the Python-list mailing list