Post Reply 
Strange results for MOD in CAS
03-03-2024, 07:32 PM
Post: #6
RE: Strange results for MOD in CAS
MOD is not a synonym of mod in CAS.

If xcas_mode()==0, mod will build an element of Z/nZ, like 27 mod 5 -> 2 %% 5.
If xcas_mode()>0, mod will call irem and return an element of Z; 27 mod 5 -> 2
The difference will become clear if you make further operations on the result, e.g. multiply by 3.
It's unclear for me how xcas_mode can be modified on the Prime...

MOD in CAS will call _MODULO in rpn.cc, it's not the same code as irem, I don't remember the difference, probably _MODULO behaves more like MOD in HOME.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Strange results for MOD in CAS - Joe Horn - 02-25-2024, 08:15 AM
RE: Strange results for MOD in CAS - parisse - 03-03-2024 07:32 PM



User(s) browsing this thread: 1 Guest(s)