Skip to content

change the mod method of rationals #21748

@videlec

Description

@videlec

The current behavior of mod on Sage rationals is currently useless

sage: (2/3).mod(5)
0
sage: (2/3).mod(6)
0

And very different from what mod_ui does

sage: (2/3).mod_ui(5)
4
sage: (2/3).mod_ui(6)
Traceback (most recent call last):
...
ArithmeticError: The inverse of 3 modulo 6 is not defined.

This ticket stands for:

  • changing the behavior of mod on rationals to be consistent to the current mod_ui (and handle the potential overflow in mod_ui)
  • deprecate mod_ui in favor of mod

This change will make Sage compatible with PARI/GP Mod and maple mod.

Component: basic arithmetic

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions