From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Ada.Numerics.Big_Numbers.Big_Integer has a limit of 300 digits?
Date: Wed, 22 Dec 2021 19:48:42 +0200 [thread overview]
Message-ID: <j2h6nrFc4ppU1@mid.individual.net> (raw)
In-Reply-To: <304dcae2-8b20-43ff-8769-32fa06d4dc10n@googlegroups.com>
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.
>>>
>>> It is repeatedly described as an "arbitrary precision library"
>>> that has user defined implementation.
Surely not "user defined"? Possibly "implementation defined".
>>> I was under the impression that this library would be able to
>>> infinitely calculate numbers of any length,
I have the same impression (up to Storage_Error, of course).
>> 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.
How does it break? Some exception, or something else?
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.
next prev parent reply other threads:[~2021-12-22 17:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 5:57 Ada.Numerics.Big_Numbers.Big_Integer has a limit of 300 digits? Michael Ferguson
2021-12-22 8:25 ` Mark Lorenzen
2021-12-22 11:14 ` AdaMagica
2021-12-22 11:32 ` AdaMagica
2021-12-22 16:04 ` AdaMagica
2021-12-22 17:37 ` Niklas Holsti
2021-12-22 20:34 ` Simon Wright
2021-12-22 17:01 ` Luke A. Guest
2021-12-22 17:27 ` Michael Ferguson
2021-12-22 17:43 ` Ben Bacarisse
2021-12-22 17:48 ` Niklas Holsti [this message]
2021-12-22 18:02 ` Michael Ferguson
2021-12-22 19:05 ` Niklas Holsti
2021-12-23 8:31 ` Luke A. Guest
2021-12-23 8:54 ` Dmitry A. Kazakov
2021-12-23 11:41 ` AdaMagica
2021-12-23 12:18 ` Niklas Holsti
2021-12-23 14:01 ` Ben Bacarisse
2021-12-22 19:26 ` Mark Lorenzen
2021-12-22 20:43 ` Niklas Holsti
2021-12-22 20:31 ` Paul Rubin
2021-12-22 20:39 ` Paul Rubin
2021-12-23 15:48 ` Jeffrey R.Carter
2021-12-24 9:09 ` AdaMagica
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox