Q: Feature Wish: "%" Extension

Paul Rubin phr-n2001d at nightsong.com
Sun Nov 4 13:05:40 EST 2001


Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> writes:
> Intel processors and C99 do the first variant. Python does the third
> variant. Knuth says the third variant is the true one. In SML and
> Haskell the first variant is called quot/rem and the third is called
> div/mod.

Knuth says to use floor_mod?  Where?
Every CPU that I know of uses trunc_mod (your 1st variant).
Floor_mod makes more sense for a lot of things.  I can't help
thinking there must be a reason for all the implementations
using trunc_mod, but I don't know what it might be.



More information about the Python-list mailing list