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

Reply via email to