comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Mathpaqs release 30-May-2015
Date: Wed, 03 Jun 2015 11:09:17 -0700
Date: 2015-06-03T11:09:17-07:00	[thread overview]
Message-ID: <mknfq4$spk$1@dont-email.me> (raw)
In-Reply-To: <5edab958-045b-467f-b7ff-af628884e442@googlegroups.com>

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


  reply	other threads:[~2015-06-03 18:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 12:27 Mathpaqs release 30-May-2015 gautier_niouzes
2015-06-03 15:16 ` vincent
2015-06-03 15:41 ` vincent.diemunsch
2015-06-03 18:09   ` Jeffrey R. Carter [this message]
2015-06-04  7:25     ` Vincent
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox