bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: support for comparison of unlimited-length integers in expr and test


From: Jim Meyering
Subject: Re: support for comparison of unlimited-length integers in expr and test
Date: Sat, 28 May 2005 08:20:19 +0200

Paul Eggert <address@hidden> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]