-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
Inconsistency in integer quotient #2579
Comments
comment:1
sage: a=-17 sage: a//4 -5 sage: a.div(4) -4 sage: a.mod(4) 3 I recommend we redefine def div(self, other):
|
This comment has been minimized.
This comment has been minimized.
comment:3
If we want a.div(b) to be floor(a/b) (which I agree we probably do, if we want the method to exist at all), the correct fix is to change from mpz_tdiv_qr to mpz_fdiv_q. |
I think the basis logic should be as below. Since this will make the remainder always positive.
|
Attachment: integerdiv.patch.gz |
comment:5
I used quo_rem to redefine div. I would have essentially copied and pasted quo_rem otherwise. |
comment:6
Looks good to me. |
This comment has been minimized.
This comment has been minimized.
comment:8
Merged in Sage 2.11.alpha0 |
I recommend we redefine
Component: basic arithmetic
Issue created by migration from https://trac.sagemath.org/ticket/2579
The text was updated successfully, but these errors were encountered: