[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assertion in sort.c
From: |
John Darrington |
Subject: |
Re: Assertion in sort.c |
Date: |
Thu, 6 Jan 2005 18:43:58 +0800 |
User-agent: |
Mutt/1.5.4i |
On Wed, Jan 05, 2005 at 09:30:12PM -0800, Ben Pfaff wrote:
> This line seems somewhat strange:
>
> assert(max_order == 1 ||
> (xsrt->run_cnt + dummy_run_cnt) % (max_order - 1) == 1);
This is from Knuth vol. 3 2nd ed. pp. 361. After adding the
dummy runs, we should have S == 1 (modulo P - 1). Oops: 0 == 1
(modulo 1), so the first part of the test should actually be
max_order == 2.
I've checked in the fix (it just changes that one character).
Let me know if there's another problem.
But now if max_order happens to equal 1, then the right hand part will
be dividing by zero :-(
J'
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://wwwkeys.pgp.net or any PGP keyserver for public key.
pgpYHAiE9HICF.pgp
Description: PGP signature
- Re: Assertion in sort.c, (continued)
- Re: Assertion in sort.c, Ben Pfaff, 2005/01/09
- Re: Assertion in sort.c, John Darrington, 2005/01/09
- Re: Assertion in sort.c, Ben Pfaff, 2005/01/09
- Re: Assertion in sort.c, John Darrington, 2005/01/16
- Re: Assertion in sort.c, Ben Pfaff, 2005/01/16
- Re: Assertion in sort.c, John Darrington, 2005/01/16
- Re: Assertion in sort.c, Ben Pfaff, 2005/01/17
Re: Assertion in sort.c,
John Darrington <=