Right now BigFraction and Fraction are separate parallel classes.

I propose altering this so that BigFraction extends Fraction, overrides its
methods, but also keeps its own unique methods.

I think it would be an improvement to the API to have both classes share
the same interface (and indeed an interface-based solution would be
possible, but strikes me as overkill, since I don't see any additional
classes beyond Fraction and BigFraction). BigFraction would in addition
have its current methods to convert BigIntegers to ints and longs.

Among the elegancies afforded by this change, if a Fraction operation
causes overflow as previously discussed, a BigFraction could be returned
and should be able to handle all further calls to Fraction unaltered. (This
might not always be desired behavior, so Fraction may need to contain a
setting to either throw and exception, or convert to BigFraction in case of
overflow.)

So I propose writing a ticket for this change. As sub-points on the ticket
the BigFraction class could be conformed to Fraction class in terms of
reduction of constants and producing a VALJO.

Eric

Reply via email to