Ticket #4539: trac4539_monomial_quotient.patch

File trac4539_monomial_quotient.patch, 1.1 KB (added by AlexanderDreyer, 5 years ago)

monomial_quotient should throw instead of return nonsense

  • sage/rings/polynomial/plural.pyx

    # HG changeset patch
    # Parent 075b13232e76448585b346a203bc23cf4c8a7ba2
    
    diff --git a/sage/rings/polynomial/plural.pyx b/sage/rings/polynomial/plural.pyx
    a b  
    869869        TESTS::
    870870
    871871            sage: P.monomial_quotient(x,y) # Note the wrong result
    872             x*y^1048575*z^1048575 # 64-bit
    873             x*y^65535 # 32-bit 
     872            Traceback (most recent call last):                                                                                         
     873            ...
     874            ValueError: Head term of left hand side must be a multiple of the head term of right-hand side.
    874875
    875876        .. warning::
    876877
     
    878879           term of g and return the multiplicant m. If this rule is
    879880           violated, funny things may happen.
    880881        """
     882        if not self.monomial_divides(g.lt(), f.lt()):
     883            raise ValueError, "Head term of left hand side must be a multiple of the head term of right-hand side."
    881884        cdef poly *res
    882885        cdef ring *r = self._ring
    883886        cdef number *n, *denom