Open rtoy opened 3 days ago
Imported from SourceForge on 2024-07-04 14:01:51 Created by wjenkner on 2003-03-22 15:42:28 Original: https://sourceforge.net/p/maxima/bugs/264/#e90f
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
Imported from SourceForge on 2024-07-04 14:01:55 Created by wjenkner on 2003-11-07 17:44:32 Original: https://sourceforge.net/p/maxima/bugs/264/#e882
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
Imported from SourceForge on 2024-07-04 14:01:58 Created by robert_dodier on 2005-12-12 16:15:59 Original: https://sourceforge.net/p/maxima/bugs/264/#bd85
Imported from SourceForge on 2024-07-04 14:02:02 Created by robert_dodier on 2005-12-12 16:15:59 Original: https://sourceforge.net/p/maxima/bugs/264/#37d9
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.
Imported from SourceForge on 2024-07-04 14:02:05 Created by robert_dodier on 2006-07-04 16:21:46 Original: https://sourceforge.net/p/maxima/bugs/264/#d213
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]
Imported from SourceForge on 2024-07-04 14:02:09 Created by robert_dodier on 2006-07-04 16:21:46 Original: https://sourceforge.net/p/maxima/bugs/264/#4b67
Imported from SourceForge on 2024-07-04 14:02:12 Created by dgildea on 2016-11-19 09:23:42 Original: https://sourceforge.net/p/maxima/bugs/264/#27b2
Seems to be fixed now.
Maxima branch_5_38_base_351_ge2a6f50 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
(%i5) makelist(polymod(i,4),i,-8,8);
(%o5) [0,1,2,-1,0,1,2,-1,0,1,2,-1,0,1,2,-1,0]
Imported from SourceForge on 2024-07-04 14:02:16 Created by robert_dodier on 2022-11-02 19:19:53 Original: https://sourceforge.net/p/maxima/bugs/264/#bcc0
Diff:
--- 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
Imported from SourceForge on 2024-07-04 14:02:19 Created by robert_dodier on 2022-11-02 19:19:54 Original: https://sourceforge.net/p/maxima/bugs/264/#f7ed
Marking this "maybe fixed", I think I'd like to review this and verify the status of it.
Imported from SourceForge on 2024-07-04 14:01:50 Created by macrakis on 2003-03-19 22:07:08 Original: https://sourceforge.net/p/maxima/bugs/264
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 formod(x,4)
instead of four.Maxima 5.9.0 GCL 2.5.0 mingw Windows 2000