id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
12121 floor/ceil can be very slow at integral values dsm AlexGhitza "Reported (in slightly different form) on [http://ask.sagemath.org/question/964/lenlist-ceillog42-bugs ask.sagemath.org]:
{{{
sage: %timeit floor(log(3)/log(2))
625 loops, best of 3: 586 µs per loop
sage: %timeit floor(log(4)/log(2))
5 loops, best of 3: 3.79 s per loop
}}}
This happens because ceil and floor first try to increase the precision of a coercion of the input argument to a `RealInterval` by 100 bits from 53 to 20000 before finally trying a full_simplify, which succeeds. The `RealInterval` rounds all fail because the interval is always of the form (2 - epsilon, 2 + epsilon) and endpoints have different ceilings.
With the branch applied `math.floor` and `numpy.floor` are used directly
{{{
sage: floor(1.2r)
1.0
sage: type(_)
}}}
which is distinct from the current Sage behavior
{{{
sage: floor(1.2r)
1
sage: type(_)
}}}" defect needs_work major sage-7.3 basic arithmetic kcrisman jdemeyer pelegm Vincent Delecroix Marc Mezzarobba, Ralf Stephan N/A test failures u/mmezzarobba/ticket/12121-rebased 1b1a32abd788a451a7004c833f03c7a94f86753f