[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] Support arbitrarily-long numbers with GNU MP.
From: |
James Youngman |
Subject: |
Re: [PATCH 1/2] Support arbitrarily-long numbers with GNU MP. |
Date: |
Sun, 3 Aug 2008 13:56:21 +0100 |
On Wed, Jul 30, 2008 at 12:32 AM, Paul Eggert <address@hidden> wrote:
> "James Youngman" <address@hidden> writes:
>
>> Although libgmp itself has no further dependencies other than the C
>> library, this is still a large-ish extra dependency. Should we also
>> introduce a --without-gmp option to configure?
>
> Yes, particularly if it's added to 'expr'.
See the patch I posted yesterday.
>> I also remember Jim mentioning something about supporting large
>> numbers in expr. That seems feasible, though based on the number of
>> discussions over the last year or two I would suggest that perhaps
>> using GMP in "seq" might also be a win; thoughts?
>
> They'd both be wins, I'd say.
>
> Also "test", right? Though that's lower priority.
As far as I can see, the only places where test handles numbers are
-lt, -gt, -le, -ge, -eq, -ne
Here the comparison is done with strintcmp, which compares numbers
without converting them from a string. That is, strintcmp already
works to arbitrary precision.
-l
This introduces an integer constant, the value of which is the length
of the following string
/usr/bin/test -l foo -eq 3 ; echo $?
0
Here I believe there is no need for bignums; a size_t is wide enough
to represent the size of any string, and the argument is a string
taken from the command line.
In fact the length is immediately printed and handled as for -lt and
similar anyway.
-t
Here the following argument is a file descriptor. Since they need to
be representible as an int, there is no need for arbitrary precision
here either.
So as far as I can see, "test" already supports arbitrarily long
numbers in all the cases where it makes sense.
James.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 1/2] Support arbitrarily-long numbers with GNU MP.,
James Youngman <=