Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'explicitly': 0.05; 'definitions': 0.07; 'agrees': 0.09; 'integers': 0.09; "people's": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'suggest': 0.14; 'complaining': 0.16; 'for,': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'here).': 0.16; 'other)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'situation.': 0.16; 'sources,': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'library': 0.18; 'looked': 0.18; 'ticket': 0.19; 'everyone,': 0.19; 'stefan': 0.19; 'foundation': 0.20; 'header:User-Agent:1': 0.23; 'mathematical': 0.24; 'decide': 0.24; 'question': 0.24; 'references': 0.26; 'tracker': 0.26; 'somewhere': 0.26; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'breaking': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'anyone': 0.31; 'open': 0.33; 'says': 0.33; 'sources': 0.33; 'actual': 0.34; 'problem': 0.35; 'common': 0.35; 'definition': 0.35; 'equal': 0.35; 'received:84': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'raising': 0.36; 'should': 0.36; 'changing': 0.37; 'so,': 0.37; 'two': 0.37; 'being': 0.38; 'generic': 0.38; 'on-line': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'university': 0.39; 'received:org': 0.40; 'how': 0.40; 'even': 0.60; 'greatest': 0.60; 'ground': 0.60; 'negative': 0.60; 'hope': 0.61; 'new': 0.61; 'numbers': 0.61; 'back': 0.62; 'name': 0.63; 'such': 0.63; 'visit': 0.64; 'more': 0.64; 'shortly': 0.68; 'conflicts': 0.84; 'mathematica': 0.84; 'standing': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: GCD in Fractions Date: Wed, 24 Sep 2014 18:13:23 +0200 References: <54216c8e$0$29966$c3e8da3$5496439d@news.astraweb.com> <5422ae8b$0$29980$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-084-056-048-104.084.056.pools.vodafone-ip.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411575221 news.xs4all.nl 2913 [2001:888:2000:d::a6]:59933 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78295 blindanagram schrieb am 24.09.2014 um 15:25: > On 24/09/2014 12:44, Steven D'Aprano wrote: > >> blindanagram wrote: > [snip] >> - Mathworld says that GCD of two negative numbers is a negative number; >> >> - but Mathematica says that GCD of two negative numbers is a positive; >> >> - Wikipedia agrees with Mathematica and disagrees with Mathworld; > > After looking at these (and several other) on-line mathematical sites, I > realised that I would have to go back to long standing mathemmatical > references to find how the gcd is defined by those that explicitly cover > the greatest common divisor for negative integers (I did this before > raising the issue here). > > All four that I have so far looked at have definitions that lead to > gcd(a, b) for integers being equal to gcd(|a|, |b|). I hope to visit a > University library shortly to review more. Does anyone know of such a > reference that uses a definition that conflicts with gcd(a, b) for > integers being equal to gcd(|a|, |b|)? Steven has already given sources that suggest that the result of gcd() should be positive. Just like he gave sources that suggest the opposite. So, the question is not how or where to find even more sources, or to decide which of those sources is "more right" than the others, the question is whether such a shaky ground is a reasonable foundation for breaking other people's code. We have an open tracker ticket now on changing *something* about the current situation. Let's just add some new functionality somewhere if people really want it (as in "need it for their code", not just "want it for purity reasons" or "sleep better when they know it's out there"), but please, everyone, stop complaining about "fractions.gcd" not catering for your needs. It does what it's there for, even if the name is more public or more generic than you might want. There are other ways to fix the actual problem and move on. Stefan