Paul Eggert <[EMAIL PROTECTED]> wrote:
> The recent bug-fix to expr got me to thinking: why doesn't expr simply
> compare integers of unlimited length, the way "sort" does?  That can
> be done cheaply.  "test" has a similar problem.  I installed the
> following patch to implement this idea.
>
> This fixes all the integer-overflow problems I know of with "test",
> but "expr" still has quite a few problems, e.g., "expr
> 9223372036854775807 + 1" still prints "-9223372036854775808".
>
> How about if we modify "expr" to use GMP <http://swox.com/gmp/>
> instead, so that expr doesn't overflow unless it runs out of memory?
> The disadvantage is a reliance on the GMP library, but the advantage
> is that expr will "just work".  We can fall back to the current
> approach if GMP is not available.

Thanks for doing that.

Yes, it'd be nice to use GMP when it's available.
And not just for expr.  Factor would benefit from using
it, too.  For example, the sample program (factorize.c) in GMP
already provides a couple of efficient algorithms.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to