Ticket #105 (closed defect: fixed)
bug in new temp allocation
| Reported by: | robertwb | Owned by: | somebody |
|---|---|---|---|
| Priority: | blocker | Milestone: | 0.10 |
| Component: | Code Generation | Keywords: | |
| Cc: |
Description
In the function below, a temp is not marked as unused and gets dereferenced twice.
def coeffs_bitsize(self):
"""
Computes the approximate log2 of the maximum of the absolute
values of the coefficients.
EXAMPLES:
sage: from sage.rings.polynomial.real_roots import *
sage: bernstein_polynomial_factory_ratlist([1, 2, 3, -60000]).coeffs_bitsize()
15
sage: bernstein_polynomial_factory_ratlist([65535/65536]).coeffs_bitsize()
-1
sage: bernstein_polynomial_factory_ratlist([65536/65535]).coeffs_bitsize()
1
"""
# This returns an estimate of the log base 2 of the rational in the
# list with largest absolute value. The estimate is an integer,
# and within +/- 1 of the correct answer.
r = max([bitsize(c.numerator()) - bitsize(c.denominator()) for c in self.coeffs])
return r
Change History
Note: See
TracTickets for help on using
tickets.
