> > 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to