Skip to content
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

mod(a, -b) does not agree with Julia/AbstractAlgebra #688

Closed
wbhart opened this issue Nov 7, 2019 · 0 comments · Fixed by #693
Closed

mod(a, -b) does not agree with Julia/AbstractAlgebra #688

wbhart opened this issue Nov 7, 2019 · 0 comments · Fixed by #693

Comments

@wbhart
Copy link
Contributor

wbhart commented Nov 7, 2019

When the modulus is negative, Nemo always returns a positive remainder. This is inconsistent with what Julia or AbstractAlgebra does. We should switch to the Julia definition.

For example, mod(2, -3) returns -1 in Julia and 2 in Nemo. The Julia definition is better because if a = 2 and m = -3 we have:

a = mq + r where q = -1 and r is between 0 and m.

And just for fun:

mod(ZZ(2), -3)

currently returns 0ffffffffffffffff which wouldn't be my favourite answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant