rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

rat/tellrat/modulus:2 can return -1 on GCL (SBCL OK) #2544

Open rtoy opened 2 months ago

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-06 14:03:31 Created by macrakis on 2003-11-05 19:00:54 Original: https://sourceforge.net/p/maxima/bugs/438


algebraic:true$ modulus:2$
tellrat(a^2+a)$

rat(a^2) => - a

With modulus=2, -1 is supposed to simplify to 1.

This can be fixed (bizarrely) by ev:

ev(%) => a
rtoy commented 2 months ago

Imported from SourceForge on 2024-07-06 14:03:32 Created by wjenkner on 2003-11-07 17:38:51 Original: https://sourceforge.net/p/maxima/bugs/438/#de06


Logged In: YES user_id=581700

On both SBCL and CLISP I get the expected result

(C4) rat(a^2); (D4)/R/ a

I'd guess this is the same GCL specific misfeature as #706562 (mod(-2,4) => -2 not 2).

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-06 14:03:35 Created by robert_dodier on 2006-07-13 05:22:02 Original: https://sourceforge.net/p/maxima/bugs/438/#5083


Logged In: YES user_id=501686

Observed w/ 5.9.3cvs / gcl 2.6.7, but not 5.9.3cvs / sbcl 0.9.9 or clisp 2.38.

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-06 14:03:39 Created by robert_dodier on 2006-07-13 05:22:02 Original: https://sourceforge.net/p/maxima/bugs/438/#8596


rtoy commented 2 months ago

Imported from SourceForge on 2024-07-06 14:03:42 Created by robert_dodier on 2021-07-02 19:02:09 Original: https://sourceforge.net/p/maxima/bugs/438/#0909


Referred-to ticket #706562 is presumably https://sourceforge.net/p/maxima/bugs/264/ (due to system-wide renumbering several years ago). #264 is reported to be fixed so maybe this bug just needs to be retested.

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-06 14:03:46 Created by robert_dodier on 2021-07-03 06:46:07 Original: https://sourceforge.net/p/maxima/bugs/438/#5a45


Retested w/ not-too-old Maxima + GCL and bug is still present.

(%i3) algebraic:true$ modulus:2$

(%i5) tellrat(a^2+a)$

(%i6) 
rat(a^2);
(%o6)/R/                              - a
(%i7) ev(%);
(%o7)/R/                               a
Maxima version: "branch_5_44_base_181_geeb4b055f_dirty"
Maxima build date: "2020-12-08 08:54:55"
Host type: "i686-pc-linux-gnu"
Lisp implementation type: "GNU Common Lisp (GCL)"
Lisp implementation version: "GCL 2.6.12"
User dir: "/home/robert/.maxima"
Temp dir: "/tmp"
Object dir: "/home/robert/.maxima/binary/branch_5_44_base_181_geeb4b055f_dirty/gcl/GCL_2_6_12"
Frontend: false
rtoy commented 2 months ago

Imported from SourceForge on 2024-07-06 14:03:49 Created by macrakis on 2021-07-03 18:43:08 Original: https://sourceforge.net/p/maxima/bugs/438/#dc37