I just started using the Big_Integer library that is a part of the 202X version of ADA.
It is repeatedly described as an "arbitrary precision library" that has user defined implementation.
I was under the impression that this library would be able to infinitely calculate numbers of any length, but there is clearly a default limit of 300 digits.
Bignum_Limit : constant := 200;RM 2.2(14) limiits the line length and the length of lexical elements to 200.
I just started using the Big_Integer library that is a part of the 202X version of ADA.
It is repeatedly described as an "arbitrary precision library" that has user defined implementation.
I was under the impression that this library would be able to infinitely calculate numbers of any length, but there is clearly a default limit of 300 digits.
On Wednesday, December 22, 2021 at 11:02:03 AM UTC-6, Luke A. Guest wrote:
On 22/12/2021 05:57, Michael Ferguson wrote:
I just started using the Big_Integer library that is a part of the 202X version of ADA.
It is repeatedly described as an "arbitrary precision library" that has user defined implementation.
I was under the impression that this library would be able to
infinitely calculate numbers of any length, but there is clearly a
default limit of 300 digits.
What are you doing that requires that number of digits?
I am working on ProjectEuler.net problem number 48.
The questions asks you to sum the numbers n^n for (2 <= n <= 1000) and determine what the last ten digits of this number are.
Obviously, this is quite a trivial problem when using any arbitrary
precision library.
Bignum_Limit : constant := 200;RM 2.2(14) limiits the line length and the length of lexical elements to 200.
On 22/12/2021 05:57, Michael Ferguson wrote:
I just started using the Big_Integer library that is a part of the 202X version of ADA.
It is repeatedly described as an "arbitrary precision library" that has user defined implementation.
I was under the impression that this library would be able to infinitely calculate numbers of any length, but there is clearly a default limit of 300 digits.What are you doing that requires that number of digits?
On Wednesday, December 22, 2021 at 11:02:03 AM UTC-6, Luke A. Guest wrote:
On 22/12/2021 05:57, Michael Ferguson wrote:
I just started using the Big_Integer library that is a part of the 202X version of ADA.
It is repeatedly described as an "arbitrary precision library"
that has user defined implementation.
I was under the impression that this library would be able to
infinitely calculate numbers of any length,
but there is clearly a default limit of 300 digits.
What are you doing that requires that number of digits?
I am working on ProjectEuler.net problem number 48.
The questions asks you to sum the numbers n^n for (2 <= n <= 1000)
and determine what the last ten digits of this number are.
Obviously, this is quite a trivial problem when using any arbitrary
precision library.
I had incorrectly determined that 700^700 had 300 digits, in fact
700^700 = 3.7E1991.
However, my code strictly breaks when the loop range is set to 683,
which 683^683 = 8.12E1935.
On 2021-12-22 19:27, Michael Ferguson wrote:
On Wednesday, December 22, 2021 at 11:02:03 AM UTC-6, Luke A. Guest wrote:Surely not "user defined"? Possibly "implementation defined".
On 22/12/2021 05:57, Michael Ferguson wrote:
I just started using the Big_Integer library that is a part of the 202X version of ADA.
It is repeatedly described as an "arbitrary precision library"
that has user defined implementation.
I have the same impression (up to Storage_Error, of course).I was under the impression that this library would be able to
infinitely calculate numbers of any length,
but there is clearly a default limit of 300 digits.
What are you doing that requires that number of digits?
I am working on ProjectEuler.net problem number 48.
The questions asks you to sum the numbers n^n for (2 <= n <= 1000)
and determine what the last ten digits of this number are.
Obviously, this is quite a trivial problem when using any arbitrary precision library.
I had incorrectly determined that 700^700 had 300 digits, in fact
700^700 = 3.7E1991.
However, my code strictly breaks when the loop range is set to 683,How does it break? Some exception, or something else?
which 683^683 = 8.12E1935.
Mark Lorenzen suggested in an earlier post that the limit might be in
the Big_Integer'Image function. The package Ada.Numerics.Big_Numbers.Big_Integers has some other output operations
that you could try:
function To_String (Arg : Valid_Big_Integer; ...) return String;
procedure Put_Image (Buffer : ... ; Arg: in Valid_Big_Integer);
Of course those might be internally linked to the 'Image function and
have the same possible limitation.
On Wednesday, December 22, 2021 at 11:48:46 AM UTC-6, Niklas Holsti
wrote:
On 2021-12-22 19:27, Michael Ferguson wrote:
On Wednesday, December 22, 2021 at 11:02:03 AM UTC-6, Luke A.
Guest wrote:
On 22/12/2021 05:57, Michael Ferguson wrote:
I just started using the Big_Integer library that is a part
of the 202X version of ADA.
Not 100% sure what modular types are
but I did try to do something like the following
subtype VeryBigInteger is Big_Integer range 0 .. 10E10000;
which gave "error: incorrect constraint for this kind of type"
Niklas also gave me an epiphany as the exact error my program gives
for the upper limit is
raised STORAGE_ERROR : Ada.Numerics.Big_Numbers.Big_Integers.Bignums.Normalize: big integer
limit exceeded
I had thought that since the end of this error said big integer limit exceeded it was a problem with the library, but now I'm starting to
think I need to get GNAT to allocated more memory for the program.
On Wednesday, December 22, 2021 at 11:02:03 AM UTC-6, Luke A. Guest wrote:
On 22/12/2021 05:57, Michael Ferguson wrote:
I just started using the Big_Integer library that is a part of the 202X version of ADA.
It is repeatedly described as an "arbitrary precision library" that has user defined implementation.
I am working on ProjectEuler.net problem number 48.I was under the impression that this library would be able to infinitely calculate numbers of any length, but there is clearly a default limit of 300 digits.What are you doing that requires that number of digits?
The questions asks you to sum the numbers n^n for (2 <= n <= 1000) and determine what the last ten digits of this number are.
I am working on ProjectEuler.net problem number 48. ...
Obviously, this is quite a trivial problem when using any arbitrary
precision library.
On Wednesday, December 22, 2021 at 6:27:57 PM UTC+1, Michael Ferguson
wrote:
On Wednesday, December 22, 2021 at 11:02:03 AM UTC-6, Luke A. Guest
wrote:
On 22/12/2021 05:57, Michael Ferguson wrote:I am working on ProjectEuler.net problem number 48.
I just started using the Big_Integer library that is a part ofWhat are you doing that requires that number of digits?
the 202X version of ADA.
It is repeatedly described as an "arbitrary precision library"
that has user defined implementation.
I was under the impression that this library would be able to
infinitely calculate numbers of any length, but there is
clearly a default limit of 300 digits.
The questions asks you to sum the numbers n^n for (2 <= n <= 1000)
and determine what the last ten digits of this number are.
Interesting. Assume that the problem is related to the maximum size
of lexical elements, can't you then use the "rem" function from
Big_Integers to determine the last 10 digits e.g. by something like
this Last_10_Digits = My_Very_Large_Number rem To_Big_Integer(1) **
10?
However, my code strictly breaks when the loop range is set to 683,
which 683^683 = 8.12E1935.
So, that is interesting that the Big_Integer type works numbers of
just under 2000 digit length despite Bignum_Limit : constant := 200.
There is a limit
Bignum_Limit : constant := 200;
in System.Generic_Bignums body, function Normalize, lines 1100ff.
On 22/12/2021 19:05, Niklas Holsti wrote:
Big_Integers package does not directly support computations "mod"
something (perhaps this should be an extension in a later Ada
standard, because such computations are quite common).
Is mod overloadable?
Big_Integers package does not directly support computations "mod"
something (perhaps this should be an extension in a later Ada standard, because such computations are quite common).
However, the
Big_Integers package does not directly support computations "mod"
Niklas Holsti schrieb am Mittwoch, 22. Dezember 2021 um 20:05:21 UTC+1:
However, the
Big_Integers package does not directly support computations "mod"
It does A.5.6(18/5).
In my imperfect understanding, intrinsically modular big-number
computations can be much more efficient than such post-computation applications of "mod", at least if the modulus is not itself a big
number.
I was under the impression that this library would be able to infinitely calculate numbers of any length, but there is clearly a default limit of 300 digits.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 399 |
Nodes: | 16 (3 / 13) |
Uptime: | 64:45:21 |
Calls: | 8,355 |
Calls today: | 15 |
Files: | 13,159 |
Messages: | 5,893,806 |
Posted today: | 1 |