Skip to content

uniformise the behaviour of gcd for rational numbers #3214

@novoselt

Description

@novoselt

I got very confused by the first line since I used to use gcd for clearing denominators:

sage: gcd((1, 2/3, 1/6, 1/6))
1
sage: gcd((2/3, 1/6, 1/6))
1/6
sage: gcd((2/3, 1, 1/6, 1/6))
Traceback (most recent call last):
...
TypeError: Argument 'other' has incorrect type (expected sage.rings.rational.Rational, got sage.rings.integer.Integer)
sage: gcd((2/3, 2/2, 1/6, 1/6))
1/6

I'd expect all calls above to return 1/6.

CC: @robertwb @craigcitro @JohnCremona @burcin

Component: basic arithmetic

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions