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

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/6cb853c5-90ff-41cc-8cd6-da3834497c22%40gmail.com.

Reply via email to