#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 deinst):

 OK, I think I've figured out why no one has moved the code from `__call__`
 to `_eval`.  If we do the replacement (returning None if we cannot
 simplify) then if we call `ceil` or `floor` with a nonnumeric argument
 then `BuiltinFunction.__call__` delegates to `Function.__call__` which
 coerces its result to an expression as follows
 {{{
         return new_Expression_from_GEx(SR, res)
 }}}

 So the result of `floor` or `ceil` is an expression (that consists of just
 an integer.)

 At first glance, this seems harmless enough, but for to coerce an
 expression into an integer we call `floor` or `ceil`, and that wont work
 if `floor` or `ceil` is not returning an integer then we don't accomplish
 much.  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`.

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