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=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Mathpaqs release 30-May-2015 Date: Wed, 03 Jun 2015 11:09:17 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <5edab958-045b-467f-b7ff-af628884e442@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Wed, 3 Jun 2015 18:08:06 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="a3855fbfe1a666be9aefba0563039ed5"; logging-data="29492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+YrzXUwAHm9up+y5vnFgDVc0qyXt75bg=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <5edab958-045b-467f-b7ff-af628884e442@googlegroups.com> Cancel-Lock: sha1:Mt24Jc3zapbMAdm13OMb6f9fAs4= Xref: number.nntp.giganews.com comp.lang.ada:193468 Date: 2015-06-03T11:09:17-07:00 List-Id: On 06/03/2015 08:41 AM, vincent.diemunsch@gmail.com wrote: > > I am really interested by your multiprecision integers. I am happy to see > that they are implemented in Ada. The trouble with his multiprecision integers is that, for each variable, you have to specify the number of "digits" it can hold. You can sometimes get around this by using the result of an expression as the initialization of an object. But sometimes it is difficult, especially if you want to write portable code, since the size of a "digit" is determined by a constant from System. The alternative to this is to have unbounded integers, with the number of "digits" determined by the value. This is generally implemented using access types, allocation, and deallocation, which can be difficult to get right. However, in the beta version of the PragmAda Reusable Components for ISO/IEC 8652:2007, there is an Unbounded_Integers pkg that does not (explicitly) use access types. The division algorithm might be a bit slow. > I used to write a binding to GMP and MPFR but I only considered "Unbounded > Integers", implemented as controlled types, just like unbounded_strings are > implemented. Do you know how fast is your Library compared to GMP ? Advantages to a binding to something like GMP is that it is well tested and fast. The disadvantage is that it is a binding to something written in not-Ada. Also, a decent binding might use 3 subprogram calls where a native pkg would only use 1 (your code calls the thick binding, which calls the thin binding, which calls the imported code), and convert types, which might be enough to make up for the speed difference. The PragmARCs are at https://pragmada.x10hosting.com/pragmarc.htm -- Jeff Carter "If a sperm is wasted, God gets quite irate." Monty Python's the Meaning of Life 56