[issue21712] fractions.gcd failure

2014-06-10 Thread Pablo Acosta
New submission from Pablo Acosta: The Greatest Common Divisor (gcd) algorithm sometimes breaks because the modulo operation does not always return a strict integer number, but one very, very close to one. This is enough to drive the algorithm astray from that point on. Example: >>

[issue21712] fractions.gcd failure

2014-06-10 Thread Pablo Acosta
Pablo Acosta added the comment: Actually probably int(round(a%b)) would be better. -- ___ Python tracker <http://bugs.python.org/issue21712> ___ ___ Python-bug

[issue21712] fractions.gcd failure

2014-06-10 Thread Pablo Acosta
Pablo Acosta added the comment: I will correct myself one more time (hopefully the last): while b: a, b = b, round(a % b, 10) return a a b fractions.gcd proposed_algorithm -- 48

[issue21712] fractions.gcd failure

2014-06-11 Thread Pablo Acosta
Pablo Acosta added the comment: Understood and agreed. My bad too for not reading the documentation more carefully. Thank you for the detailed explanation. Pablo > On Jun 11, 2014, at 2:52 PM, Tim Peters wrote: > > > Tim Peters added the comment: > > @pacosta, if Ma