Per comment below this is a GCL-specific bug. Relabeling
accordingly.
Proposed solution: For GCL, instead of importing SI:CMOD,
implement Maxima CMOD in rat3a in terms of SI:CMOD. That way
we can get the presumed speed-up as well as consistency with
other Lisp implementations.
--- old+++ new@@ -1,8 +1,6 @@-mod\(-2,4\) => -2+`mod(-2,4)` => `-2`-It should be 2 to be consistent with mod\(2,4\), mod\(6,4\), -etc. Otherwise there are FIVE distinct values for mod-\(x,4\) instead of four.+It should be 2 to be consistent with `mod(2,4)`, `mod(6,4)`, etc. Otherwise there are FIVE distinct values for `mod(x,4)` instead of four.Maxima 5.9.0 GCL 2.5.0 mingw Windows 2000
status: closed --> maybe-fixed
assigned_to: Dan Gildea --> Robert Dodier
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=581700
For both Clisp and SBCL I get
(C1) makelist(mod(i,4),i,-4,-1);
(D1) [0, 1, 2, - 1]
Wolfgang
Logged In: YES
user_id=581700
GCL imports some symbols for modular arithmetic from the SYSTEM
package (see maxima-package.lisp). In particular,
>(lisp-implementation-version)
"GCL-2-5.2000000000000002"
>(let ((si:modulus 4)) (si:cmod 2))
2
>(let ((si:modulus 4)) (si:cmod -2))
-2
The other lisps define this in rat3a.lisp
* (let ((modulus 4)) (cmod 2))
2
* (let ((modulus 4)) (cmod -2))
2
Logged In: YES
user_id=501686
Post-5.9.2, mod was renamed to polymod and nummod was
renamed to mod. Relabeling this report accordingly.
Logged In: YES
user_id=501686
Per comment below this is a GCL-specific bug. Relabeling
accordingly.
Proposed solution: For GCL, instead of importing SI:CMOD,
implement Maxima CMOD in rat3a in terms of SI:CMOD. That way
we can get the presumed speed-up as well as consistency with
other Lisp implementations.
Incidentally Maxima 5.9.3cvs / gcl 2.6.7 yields:
(%i3) makelist(polymod(i,4),i,-8,8);
(%o3) [0, 1, - 2, - 1, 0, 1, - 2, - 1, 0, 1, 2, - 1, 0, 1,
2, - 1, 0]
So there are indeed just 4 distinct values, but a different
4 than sbcl or clisp. E.g. sbcl =>
(%i1) makelist(polymod(i,4),i,-8,8);
(%o1) [0, 1, 2, - 1, 0, 1, 2, - 1, 0, 1, 2, - 1, 0, 1, 2, -
1, 0]
Seems to be fixed now.
Diff:
Marking this "maybe fixed", I think I'd like to review this and verify the status of it.