Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101993

Re: How to simulate C style integer division?

From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject Re: How to simulate C style integer division?
Date 2016-01-22 00:58 -0500
Message-ID <mailman.160.1453442317.15297.python-list@python.org> (permalink)
References <CAJQX3DyoDUtNWbNEpGVJxeKATADWAikP47NRZb7+UaxSwSRZaQ@mail.gmail.com> <n7s5oa$18c$1@ger.gmane.org> <n7s7jp$q7u$1@ger.gmane.org>

Show all headers | View raw


Terry Reedy <tjreedy@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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to simulate C style integer division? Random832 <random832@fastmail.com> - 2016-01-22 00:58 -0500

csiph-web