Skip to content

Nitpick: Sage performs euclidean division with integer remainders as opposed to non-negative integers #114

@dcbuild3r

Description

@dcbuild3r

When implementing the euclidean division algorithm as part of Exercise 3.2.6 I noticed that Sage doesn't define the remainder $r$ as a non-negative integer like in the book. It produces negative integers for certain inputs which caused some confusion when testing my implementation against Sage.

In this example the output will be $(3, -1)$ as opposed to $(4, 2)$ which satisfies the constraint of $r$ being a non-negative integer:

sage: ZZ(-10).quo_rem(ZZ(-3))
(3, -1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions