Opened 2 years ago
Closed 21 months ago
#24880 closed defect (fixed)
gcd is not commutative (on rationals)
Reported by:  vdelecroix  Owned by:  

Priority:  critical  Milestone:  sage8.2 
Component:  basic arithmetic  Keywords:  days83, thursdaysbdx 
Cc:  rws  Merged in:  
Authors:  Vincent Klein  Reviewers:  Jeroen Demeyer, Sébastien Labbé 
Report Upstream:  N/A  Work issues:  
Branch:  ce541c3 (Commits)  Commit:  ce541c3ea6180b60cfa3f1c5e0b141e04e9955ee 
Dependencies:  Stopgaps: 
Description
sage: gcd([1/1,1/2]) 1 sage: gcd([1/2,1/1]) 1/2
Though the gcd is perfectly well defined on rationals
sage: (1/1).gcd(1/2) 1/2 sage: (1/2).gcd(1/1) 1/2
Change History (11)
comment:1 Changed 2 years ago by
Version 0, edited 2 years ago
by
(next)
comment:2 Changed 22 months ago by
 Branch set to u/vklein/gcd_is_not_commutative__on_rationals_
comment:3 Changed 22 months ago by
 Commit set to 0a599ea4e1cf773578efe8ffec4d34d75ca7b081
 Status changed from new to needs_review
comment:4 Changed 22 months ago by
comment:5 followup: ↓ 8 Changed 22 months ago by
 Status changed from needs_review to needs_work
Documentation won't build correctly as you need double ::
before a doctest block of code (after TESTS
).
comment:6 Changed 22 months ago by
 Keywords thursdaysbdx added
comment:7 Changed 22 months ago by
 Commit changed from 0a599ea4e1cf773578efe8ffec4d34d75ca7b081 to ce541c3ea6180b60cfa3f1c5e0b141e04e9955ee
Branch pushed to git repo; I updated commit sha1. New commits:
ce541c3  Trac #24880: TESTS: => TESTS::

comment:8 in reply to: ↑ 5 Changed 22 months ago by
 Status changed from needs_work to needs_review
Replying to slabbe:
Documentation won't build correctly as you need double
::
after a doctest block of code (afterTESTS
).
Fixed
comment:9 Changed 22 months ago by
 Reviewers set to Jeroen Demeyer
 Status changed from needs_review to positive_review
comment:10 Changed 22 months ago by
 Reviewers changed from Jeroen Demeyer to Jeroen Demeyer, Sébastien Labbé
comment:11 Changed 21 months ago by
 Branch changed from u/vklein/gcd_is_not_commutative__on_rationals_ to ce541c3ea6180b60cfa3f1c5e0b141e04e9955ee
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
It's because the loop through the sequence is broken as soon as the partial GCD is one, which is only valid for integer GCD: