#15786: floor fails for certain expressions.
-------------------------------------+-------------------------------------
       Reporter:  fwclarke           |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.8
      Component:  symbolics          |   Resolution:
       Keywords:  floor              |    Merged in:
        Authors:  David Einstein     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/deinst/15786-floor               |  16e522fb6876ce646af7c52348056b94f3b8dfbc
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by rws):

 Just to complete the picture:

 Replying to [comment:12 deinst]:
 >... Although the `Expression` object has an `is_integer` method, it does
 not seem to have any way of getting that integer other than calling
 `floor` or `ceil`.
 This calls Pynac and performs a call to `ex::info(info_flags)` which is
 virtual so you have methods named `info()` for all subclasses of `basic`,
 see http://www.ginac.de/tutorial/#The-class-hierarchy. In fact, only
 `add`, `mul`, and `numeric` have any handling of that flag, the relevant
 code is here:

  * https://github.com/pynac/pynac/blob/master/ginac/add.cpp#L263
  * https://github.com/pynac/pynac/blob/master/ginac/mul.cpp#L469
  * https://github.com/pynac/pynac/blob/master/ginac/numeric.cpp#L1101

 The last calls back Sage's function `symbolic/pynac.pyx:cdef public bint
 py_is_integer()` which is
 {{{
    return isinstance(x, int) or isinstance(x, long) or isinstance(x,
 Integer) or \
            (isinstance(x, Element) and
             ((<Element>x)._parent.is_exact() or (<Element>x)._parent ==
 ring.SR) and
             (x in ZZ))
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15786#comment:13>
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.

Reply via email to