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 X-Google-Thread: 103376,2d4b24a39e4836e7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-24 10:51:37 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!129.240.148.23!uio.no!nntp.uib.no!gisle From: gisle@apal.ii.uib.no (Gisle =?iso-8859-1?Q?S=E6lensminde?=) Newsgroups: comp.lang.ada Subject: Re: bignums Date: 24 Jul 2001 17:51:36 GMT Organization: University of Bergen Message-ID: References: <9jifep$kf0$2@news.tpi.pl> <9jk3th$knr$1@news.huji.ac.il> NNTP-Posting-Host: apal.ii.uib.no Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: toralf.uib.no 995997096 30975 129.177.16.7 (24 Jul 2001 17:51:36 GMT) X-Complaints-To: abuse@uib.no NNTP-Posting-Date: 24 Jul 2001 17:51:36 GMT User-Agent: slrn/0.9.6.2 (SunOS) Xref: archiver1.google.com comp.lang.ada:10528 Date: 2001-07-24T17:51:36+00:00 List-Id: In article <9jk3th$knr$1@news.huji.ac.il>, Ehud Lamm wrote: >Tomasz Wegrzanowski wrote in message >news:9jifep$kf0$2@news.tpi.pl... >> Is there any unlimited-size-integer thing in Ada, >> something like gmp in C ? > >There are two issues here. First, support for bignums: there are some >package around, and it isn't too hard to hack something. >The second issue is efficiency. I seem to recall that GMP is highly >optimized, uses assembly language etc. So one may actually want or hope for >a binding to GMP. I don't know a thing about it, but I did find this web >page http://www.chiark.greenend.org.uk/~mroe/Ada/GMP/. Maybe someone knows >more about the current status of this. I also wrote a binding for GMP, and have finished the integer part of it, including a thick binding, but not for rationals and floats. I had plans to develop the rest when I have made the thick binding for floats as well, but the project stop since I personally only needed integers, and the float stuff seems to be crap, so I stoped there without finishing the project. I if anybody are interested I can put the bits together and relese it. There is one problem by making a thick binding for a library like GMP. Of cause the most natural way of making a thick binding is to use operator overloading, so that you can make code like "A = B + C;". The problem is that each new GMP number is dynamically allocated, and for uing it with operator overloading you must make a controlled type and allocate a new new number for each operation. This leads to very slow code, compared to the thin binding. In my fibonacci test there were a 1:6 difference between them. A better Idea then would be to write a new binding where one could use Ada's capability to allocate the numbers on the stack. I was member of a mailing list where we started looking at this, but it ended because all of us were having (final) exams at the time. - Gisle > > >HTH > >Ehud Lamm > > -- -- Gisle S�lensminde ( gisle@ii.uib.no ) With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. (from RFC 1925)