-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Floor (integer) division of reals and rationals #15260
Comments
comment:1
The reason is that for rationals (and apparently more generally for
where it should be
I will do a patch once i have compiled a more recent version of Sage What is fun is that
|
Author: Jan Keitel |
Branch: u/jkeitel/15260 |
Commit: |
Changed branch from u/jkeitel/15260 to u/jdemeyer/ticket/15260 |
New commits:
|
Reviewer: Jeroen Demeyer |
comment:8
Using the |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:10
I suggest just making the fixes for reals and rationals and deferring the discussion about a generic |
comment:11
Running doctests now... |
Changed author from Jan Keitel to Jan Keitel, Jeroen Demeyer |
comment:12
Tests passed, needs review. |
comment:14
Could the fix work at least for RDF and RIF ? The current situation is:
|
comment:23
Is there a reason for why we don't fix #2034 first? It seems its a really simple fix in |
comment:25
I do not agree with your semantic of
Inside |
Dependencies: #2034 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
comment:28
Replying to @videlec:
It's consistent with Python's |
comment:30
Is that what we want
Floordiv of two Python floats is a float (in both Python 2 and 3). |
comment:31
The sage-devel thread is in favor of throwing an exception. Really code shouldn't rely on |
comment:32
By the principle of least surprise, I would be in favor of ¹ This example may seem anecdotal though I constantly encounter the need for an exact division. Of course, this is only useful for generic implementation, which could be used with rings or fields. |
comment:33
Replying to @bgrenet:
In my opinion, |
comment:34
That being said, I could certainly agree with
which looks useful indeed. But I don't know if there is enough consensus for this. |
comment:35
I used Replying to @vbraun:
I do not see any such consensus in the sage-devel thread! You are the only one proposing to raise an exception... William says that it is a reasonable option, as is Jeroen's proposal. |
comment:36
See #21745 for modifying only QQ. Actually I think that a good (partial) specification would be:
|
comment:37
Replying to @jdemeyer:
Would make sense to me and would also be better from the coercion point of view. However in Sage we use to convert exact integer results to integer as in
Note that Python is sloppy about the output type
(but |
As reported in [1] and [2]
[1] https://groups.google.com/d/topic/sage-support/xE_S3WbFHzA/discussion
[2] https://groups.google.com/d/msg/sage-devel/nQDAMtqnEsY/HfpIdvc9AwAJ
Depends on #2034
CC: @williamstein @sagetrac-tmonteil @zimmermann6
Component: basic arithmetic
Author: Jan Keitel, Jeroen Demeyer
Branch/Commit: u/jdemeyer/ticket/15260 @
616f88c
Reviewer: Jeroen Demeyer, Thierry Monteil
Issue created by migration from https://trac.sagemath.org/ticket/15260
The text was updated successfully, but these errors were encountered: