From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,69bb03cc695b330a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-09 17:44:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newshub.sdsu.edu!ragnarok.cts.com!thoth.cts.com!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: Large numbers (or is Ada the choice for me?) Date: 09 Mar 2001 17:42:35 -0800 Organization: CTSnet Internet Services Sender: kst@king.cts.com Message-ID: References: NNTP-Posting-Host: king.cts.com X-Trace: thoth.cts.com 984188557 78811 209.68.192.180 (10 Mar 2001 01:42:37 GMT) X-Complaints-To: abuse@cts.com NNTP-Posting-Date: Sat, 10 Mar 2001 01:42:37 +0000 (UTC) X-Newsreader: Gnus v5.5/Emacs 20.3 Xref: supernews.google.com comp.lang.ada:5594 Date: 2001-03-09T17:42:35-08:00 List-Id: georg@ii.uib.no (Hans Georg Schaathun) writes: > I need a tool to solve large systems of linear equations, with no > floating point operations (or any other approximations) allowed. > Even though I am not a seasoned programmer, I think I'll have to > write the tool myself. > > My question is, will it be reasonably simple to handle large > rational numbers with Ada? Is there any packages for this? > > Does basic Ada (gnat) support (f.ex.) 2048-bit integers? Does > any module exist for integers of dynamic size? Are these > handled reasonably efficiently, or is there much overhead? > > I guess I will manage to implement the rational numbers without > too much hardship, but I really don't feel like implementing > arithmetics on large integers. I believe Gnat includes an arbitrary-precision rational number package; it needs it at compilation time to handle the rather stringent language rules for compile-time expressions. For a good time, try compiling Kaboom : constant := (1.0 + 1.0e-10) ** 1.0e10; The result should be a good approximation to e, but the compiler's front end will almost certainly run out of memory trying to evaluate the expression. Don't try this if your operating doesn't cope well with memory hogs. If your own application does this kind of thing, either in general or only for certain matrices, you may be in trouble. Anyway, since Gnat is GPL'ed, you can grab pieces of it and use them in your own code (with the usual restrictions). It may even provide the package as part of the runtime library. Look for something like "Universal_Arithmetic". ... Ah, found it. See packages Uintp (universal integer arithmetic) and Urealp (universal real arithmetic). Figuring out how to use them is left as an exercise. -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> MAKE MONEY FAST!! DON'T FEED IT!!