Qian Yun
unread,May 30, 2026, 2:13:08 AM (3 days ago) May 30Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fricas-devel
This will make "0^0 mod 3" return 1 instead of 0, making it
consistent with the rest of fricas.
This will make 0^0 return 1 for ZMOD.
This will not affect the other user of powmod in
"rabinProvesComposite".
- Qian
diff --git a/src/algebra/integer.spad b/src/algebra/integer.spad
index 91bc0c46..a93d2f57 100644
--- a/src/algebra/integer.spad
+++ b/src/algebra/integer.spad
@@ -186,8 +186,8 @@
-- speeds up functions like 'primes'
powmod(x, n : %, p) ==
if negative? x then x := positiveRemainder(x, p)
- zero? x => 0
zero? n => 1
+ zero? x => 0
y : % := 1
z := x
repeat
diff --git a/src/algebra/si.spad b/src/algebra/si.spad
index 736abf2f..ac28e709 100644
--- a/src/algebra/si.spad
+++ b/src/algebra/si.spad
@@ -129,8 +129,8 @@
powmod(x, n, p) ==
if negative? x then x := positiveRemainder(x, p)
- zero? x => 0
zero? n => 1
+ zero? x => 0
y : % := 1
z := x
repeat