Skip to content

quo_rem in the polynomial rings does not use canonical coercion #383

@sagetrac-jbmohler

Description

@sagetrac-jbmohler

I'm looking at the polynomial function quo_rem and I see that it does it's own
coercion manually. This feels a little wrong to me. I think it should go
through the standard coercion routines. Here's a "bug" that results:

sage: x=ZZ['x'].0
sage: y=QQ['x'].0
sage: (y+1).quo_rem(1/2*x)
(2, 1)
sage: (x+1).quo_rem(1/2*y)
...
<type 'exceptions.TypeError'>: no coercion of this rational to integer

The bug is that I don't see why these two things are treated substantially
differently. The reason I found this is because the simple "TypeError"
exception did not provide the usual message about parents being
mis-matched -- I think this is a bug in itself

The fix for all that is to make the quo_rem stuff use canonical coercion model.

All of the quo_rem instances in sage/rings/polynomial/polynomial_element_generic.py suffer from some sort of coercion impropriety.

Component: basic arithmetic

Author: Robert Bradshaw

Reviewer: William Stein

Merged: sage-4.3.1.rc2

Issue created by migration from https://trac.sagemath.org/ticket/383

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions