Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in new temp allocation #666

Closed
robertwb opened this issue Oct 30, 2008 · 1 comment
Closed

bug in new temp allocation #666

robertwb opened this issue Oct 30, 2008 · 1 comment

Comments

@robertwb
Copy link
Contributor

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([2, 3, -60000](1,)).coeffs_bitsize()
            15
            sage: bernstein_polynomial_factory_ratlist([           -1
            sage: bernstein_polynomial_factory_ratlist([65536/65535](65535/65536]).coeffs_bitsize()
)).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.denominator()) for c in self.coeffs](bitsize(c.numerator())))
        return r

Migrated from http://trac.cython.org/ticket/105

@robertwb
Copy link
Contributor Author

@robertwb changed resolution to fixed
status from new to closed
commented

Fixed http://hg.cython.org/cython-devel/rev/82084a7b654e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant