New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug in power_mod #4850
Comments
comment:1
I suggest we remove the
This would call the
So the objective of this ticket should be changed to:
Thoughts? |
Attachment: trac_4850.patch.gz |
comment:3
This is a humble patch that solves the problem of the ticket. I'm not addressing burcin's far more difficult enhancement of introducing a whole arithmetic architecture. I'm also not addressing the powermod versus power_mod, since I don't want to break existing code by third party people. |
comment:4
Given patch fixes the reported problem, and it's really simple. I will open a sage-wishlist issue for removing power_mod. |
comment:5
Merged in Sage 3.3.alpha2 |
Note above that power_mod(11,1,7) should return 4. The fix is to look at the pure python code that defines power_mod in rings/arith.py and:
change it to use some much more intelligent compiled code, i.e., either the powermod or powermod_ui methods when the first input coerces to ZZ, and
when a doesn't coerce to ZZ, just revert to the existing Python code, but make sure to throw in an
%m
somewhere before returning the answer.Add a doctest like this that illustrates non-integer input for the first argument to power_mod:
Component: basic arithmetic
Issue created by migration from https://trac.sagemath.org/ticket/4850
The text was updated successfully, but these errors were encountered: