[Python-Dev] Floor division (original) (raw)

Anders J. Munch ajm at flonidan.dk
Tue Jan 23 10:19:25 CET 2007


Tim Peters wrote:

Do note that this discussion is only about Python 3. Under the view that it was a (minor, but real) design error to /try/ extending Python's integer mod definition to floats, if mod, and divmod and floordiv go away for binary floats in P3K they should certainly go away for decimal floats in P3K too.

What design error? float.mod works perfectly.

-1 % 50 49 -1.0 % 50.0 49.0

It's only Decimal.mod that's inconsistent. float.mod has the usual floating-point inaccuracies, but then with float that goes with the territory.

I've had occasion to use it, and it was a pleasant surprise that it "just worked", so I didn't have to go to the math module and ponder over the difference between modulo or remainder. float modulo is useful, consistent and intuitive; -1 on removing that.



More information about the Python-Dev mailing list