#15501: floor(), ceil(), trunc(), round() for AA
-------------------------------------+-------------------------------------
Reporter: ppurka | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.2
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: Marc Mezzarobba | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/mmezzarobba/ticket/15501-AA_floor_ceil|
2ce91a2450a2b5389be07acf1ec8eb748a8b7bd7
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by gagern):
Had a look at the code, not sure whether I'd officially call this a
review. The diff here on trac looks broken, but after merging develop my
local changes look fine. The general approach looks sound. I wonder
whether we should support different rounding modes, the way rational
numbers do. But one can always add that in a later commit. Since rounding
mode is only an issue for actual rational numbers, this should be easy to
implement outside the candidate finding method.
I also wonder whether always calling `more_precision` is the right thing
to do. I fear there might be situations where this could lead to an
infinite loop, although I don't claim to understand all the details.
Nevertheless, perhaps at some point we should stop iterating and do
bisection on the candidate range. That is, actually compare given integers
against the algebraic number. As far as I understand it, comparison can be
done exactly in finite (although possibly long) time. Since I have no clue
as to when switching to that approach would be appropriate, I wonder
whether interleaving things might make sense: keep low and high integer
candidate bounds, and in each iteration, see whether added precision can
narrow these bounds, but also use the middle of the range to bisect it.
Sooner or later, one of these methods should succeed in narrowing the
candidate range down to one element. I guess doing this approach would
mean passing a second function to `_floor_ceil` which does the appropriate
comparison.
--
Ticket URL: <http://trac.sagemath.org/ticket/15501#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.