Email list hosting service & mailing list manager

Proposed document change Bradley Lucier (28 Nov 2022 16:38 UTC)
Fwd: Proposed document change Arthur A. Gleckler (28 Nov 2022 20:00 UTC)
Re: Fwd: Proposed document change Taylor R Campbell (29 Nov 2022 04:27 UTC)
Re: Fwd: Proposed document change Bradley Lucier (29 Nov 2022 16:45 UTC)
Re: Fwd: Proposed document change Taylor R Campbell (29 Nov 2022 18:05 UTC)
Re: Fwd: Proposed document change Bradley Lucier (29 Nov 2022 18:26 UTC)
Re: Fwd: Proposed document change Bradley Lucier (29 Nov 2022 18:39 UTC)
Re: Fwd: Proposed document change Taylor R Campbell (29 Nov 2022 18:39 UTC)
Re: Fwd: Proposed document change Arthur A. Gleckler (29 Nov 2022 22:45 UTC)
Re: Fwd: Proposed document change Bradley Lucier (01 Dec 2022 14:49 UTC)
Re: Fwd: Proposed document change Bradley Lucier (01 Dec 2022 21:30 UTC)
Re: Fwd: Proposed document change Arthur A. Gleckler (01 Dec 2022 21:33 UTC)
Re: Fwd: Proposed document change John Cowan (05 Dec 2022 05:50 UTC)
Re: Fwd: Proposed document change Arthur A. Gleckler (05 Dec 2022 22:52 UTC)
Re: Fwd: Proposed document change Bradley Lucier (06 Dec 2022 18:52 UTC)
Re: Fwd: Proposed document change John Cowan (07 Dec 2022 02:11 UTC)
Re: Fwd: Proposed document change Bradley Lucier (07 Dec 2022 16:04 UTC)
Re: Fwd: Proposed document change Arthur A. Gleckler (07 Dec 2022 17:14 UTC)
Re: Fwd: Proposed document change Taylor R Campbell (01 Dec 2022 22:09 UTC)
Re: Fwd: Proposed document change Bradley Lucier (03 Dec 2022 17:26 UTC)
Re: Fwd: Proposed document change Taylor R Campbell (04 Dec 2022 17:27 UTC)

Re: Fwd: Proposed document change Taylor R Campbell 29 Nov 2022 02:59 UTC
> Date: Mon, Nov 28, 2022 at 8:38 AM
> From: Bradley Lucier <xxxxxx@math.purdue.edu>
>
> The SRFI document has several statements like (e.g., under the
> description of floor/):
>
>   Thus r is negative iff d is negative.
>
> But in fact, r (the remainder) can be zero (which is not negative) even
> if d is negative.

Correct.  For example, (floor-remainder 4 -2) is 0.

> This is obvious, I know, but perhaps all such statements could be changed to
>
>   Thus a nonzero r is negative iff d is negative.

What I originally wrote is:

  Thus when r is nonzero, it is negative iff d is negative.

I guess this got garbled in translation from the original:

https://mumble.net/~campbell/tmp/division.txt

> On another issue, can anyone point me to a list of simple unit tests for
> all these functions?

For MIT Scheme a long time ago I wrote a collection of randomized
property tests (which, in retrospect, I implemented badly), but not a
simple set of known-answer tests:

https://git.savannah.gnu.org/cgit/mit-scheme.git/tree/tests/runtime/test-division.scm?id=631998ccfb7bc31bb94f00aff32d011560f95648

Attached is a collection of known-answer test that you could try -- I
generated it just now with MIT Scheme.  It tests the cartesian product
of:

- the five operators {floor/, ceiling/, truncate/, euclidean/, round/}
- the nine numerators {0, 1, 2, 3, 4, 5, 6, 7, 8}
- both signs for numerators
- the eight denominators {1, 2, 3, 4, 5, 6, 7, 8}
- both signs for denominators

These 1440 test cases cover zero, units, primes, a square, a composite
of distinct primes, and a cube.  (They don't, however, cover anything
that requires bignum arithmetic.)  I haven't vetted these answers in
any way other than verifying the tests pass in MIT Scheme -- I
recommend running them through the property tests, and eyeballing them
to spot-check for reasonableness.