From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:199a:: with SMTP id bm26mr1121844qkb.542.1640152629569; Tue, 21 Dec 2021 21:57:09 -0800 (PST) X-Received: by 2002:a25:ad01:: with SMTP id y1mr2522109ybi.696.1640152629236; Tue, 21 Dec 2021 21:57:09 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 21 Dec 2021 21:57:08 -0800 (PST) Injection-Info: google-groups.googlegroups.com; posting-host=98.162.234.209; posting-account=_mt0NQoAAABIfwNsuLpi-_70qS5Wcu3m NNTP-Posting-Host: 98.162.234.209 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Ada.Numerics.Big_Numbers.Big_Integer has a limit of 300 digits? From: Michael Ferguson Injection-Date: Wed, 22 Dec 2021 05:57:09 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:63234 List-Id: 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. Is there any way to get rid of this problem? Here is some example code: with Ada.Text_IO; use Ada.Text_IO; with Ada.Real_Time; use Ada.Real_Time; with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; procedure Test is package Time_IO is new Fixed_IO(Duration); start_time, end_time : Ada.Real_Time.Time; elapsed_seconds : Ada.Real_Time.Time_Span; solution : Unbounded_String; rop : Big_Integer; sum : Big_Integer := 0; begin start_time := Ada.Real_Time.Clock; for i in 1..700 loop rop := To_Big_Integer(i) ** Natural(i); sum := sum + rop; end loop; solution := To_Unbounded_String(sum'Image); end_time := Ada.Real_Time.Clock; elapsed_seconds := end_time - start_time; Put("Solution: " & solution'Image); New_Line; New_Line; Put("Program completed in "); Time_IO.Put(To_Duration(elapsed_seconds), Fore => 0, Aft => 3); Put(" seconds"); end BigTest;