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 13:59:36 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.edu!newsxfer.eecs.umich.edu!news.bu.edu!inmet!not-for-mail From: Tucker Taft Newsgroups: comp.lang.ada Subject: Re: Large numbers (or is Ada the choice for me?) Date: Fri, 09 Mar 2001 16:59:32 -0500 Organization: AverStar (formerly Intermetrics) Burlington, MA USA Message-ID: <3AA95244.94BAD60D@averstar.com> References: NNTP-Posting-Host: nebula.burl.averstar.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: inmet2.burl.averstar.com 984175173 11801 141.199.8.77 (9 Mar 2001 21:59:33 GMT) X-Complaints-To: usenet@inmet2.burl.averstar.com NNTP-Posting-Date: 9 Mar 2001 21:59:33 GMT X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:5587 Date: 2001-03-09T21:59:33+00:00 List-Id: Hans Georg Schaathun wrote: > > 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? The source for the GNAT compiler includes the source for their "universal arithmetic" package I presume, which (again, presumably) does arbitrary precision integer and rational arithmetic. > > 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. Try the GNAT compiler sources. We also have one lying around somewhere. My friends in "experimental mathematics" (sounds like fun, eh?) generally prefer to use arbitrary-precision packages based on the Chinese remainder theorem, because that allows large multiplications to be performed very efficiently. Essentially a number is represented by its value modulo a series of prime numbers, typically those just less than 2**31. Multiplication can then be done by multiplying the individual "digits" independently. A few dozen "digits" is usually enough to handle some very large numbers. > > :-- Hans Georg > -- > Signature en panne. -- -Tucker Taft stt@avercom.net http://www.averstar.com/~stt/ Chief Technology Officer, AverCom Corporation (A Titan Company) Burlington, MA USA (AverCom was formerly the Commercial Division of AverStar: http://www.averstar.com/services/ebusiness_applications.html)