How to simulate C style integer division?

Random832 random832 at fastmail.com
Fri Jan 22 00:58:29 EST 2016


Terry Reedy <tjreedy at udel.edu> writes:
> But fails with remainder 0, as others noted.  Lesson: include corner
> cases in validation test.  Anyway, my main point about writing a clear
> spec remains true.

My validation test for this was to loop both numerator and denominator
from -5 to 5 (skipping denominator 0) to cover all cases (comparing
against the original post's unoptimized code) without having to think
about a minimal set to cover them.




More information about the Python-list mailing list