Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 77981 invoked from network); 30 May 2004 21:52:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 30 May 2004 21:52:12 -0000 Received: (qmail 64273 invoked by uid 500); 30 May 2004 21:52:09 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 64235 invoked by uid 500); 30 May 2004 21:52:08 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 64220 invoked by uid 99); 30 May 2004 21:52:07 -0000 Received: from [217.12.12.138] (HELO smtp801.mail.ukl.yahoo.com) (217.12.12.138) by apache.org (qpsmtpd/0.27.1) with SMTP; Sun, 30 May 2004 14:52:07 -0700 Received: from unknown (HELO oemcomputer) (commons-dev@jakarta.apache.org@81.154.207.144 with poptime) by smtp801.mail.ukl.yahoo.com with SMTP; 30 May 2004 21:52:00 -0000 Message-ID: <008401c44690$accf05a0$90cf9a51@oemcomputer> From: "Stephen Colebourne" To: "Jakarta Commons Developers List" References: <000801c44566$97561b80$cc432cd9@oemcomputer> <40B8CC4E.5080207@steitz.com> Subject: Re: [lang] [math] org.apache.commons.lang.math.Fraction class Date: Sun, 30 May 2004 22:54:25 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N > > The existing add(), subtract(), and multiplyBy() and divide() code (as far > > as I can tell) all returned reduced fractions, so existing arithmetic code > > should largely be unaffected. The primary visible difference is that > > before > > Fraction.getFraction(2,4).equals(Fraction.getFraction(1,2))==false > > and now it would be true. > > I view the previous behavior as "surprising" and a bug, honestly. > > I am inclined to agree here; though I am not sure exactly what the > original author's intention was and how people may be using the class now. > The fact that the arithmetic operations return reduced fractions makes > it hard to understand why equals works the way that it does now. What about getNumerator()/getDenominator() - won't these change if 2/4 is held differently? I believe that we need to preserve the 2/4 concept distinct from 1/2, at least in the [lang] version. > One thing that we might want to consider, given the magnitude of the > changes, is deprecating this in [lang] and moving it to [math]. That way, > among other things, the (better) continued fraction implementation in > [math] could be used in getFraction(double). The improved gcd and checked > integer arithmetic methods in the patch might also make good additions to > o.a.c.math.MathUtils. The [lang] code needs to work and be reliable. However I suspect that a [math] version and [lang] version may be appropriate with slightly different semantics. Stephen --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org