commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul womack <pwom...@papermule.co.uk>
Subject Re: Math Fraction, reducing gcd() calls
Date Tue, 08 Apr 2014 12:52:36 GMT
Gilles wrote:
>
> I think that calling "gcd" ensures that the result will not overflow for
> the largest possible range of arguments.
>
> It's part of the code logic.
>
> Maybe you could write methods that implement the "naive" algorithms for
> addition, subtraction, ...
> Then test whether you always get correct results in your application.

Agreed; when you have a "overview" you can bypass
some of the at-each-stage precautions a general implementation
is forced to do.

My only other suggestion (which is less good) would be to use
a small LRU cache on the gcd() operation, but the success
of that would depend very much on the numeric properties
of your data.

   BugBear

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message