GMP (GNU multiple precision) wrapper for D?

Don Clugston dac at nospam.com.au
Mon Sep 24 01:16:37 PDT 2007


Michael Kiermaier wrote:
> Matthias Walter Wrote:
> 
>> Don Clugston Wrote:
>>
>>> Michael Kiermaier wrote:
>>>> Hello,
>>>>
>>>> I like D more and more.
>>>>
>>>> However, one thing I am missing up to now is a D wrapper for GMP (GNU multiple precision library), like the existing C++ wrapper classes.
>>>>
>>>> Searching for "D programming gmp" with google gives some pages which link to this homepage:
>>>> http://home.comcast.net/~benhinkle/
>>>>
>>>> But I cannot find a D wrapper there.
>>> I found I have a copy of it. It'll need work to make it compile with recent DMD.
>>> But it's very old, and D has improved a lot since then. You might be better just 
>>> running htod or bcd over the gmp headers.
>>>
>>>
>> Did anyone take the time and port it? If not, I would start a project at dsource.org and do it. What about Ben Hinkle's port? Is it active, can one get his sources somewhere?
>>
>> AFAICS, for a port, one would not need to use template metaprogramming like the original authors did in the original gmpxx headers, because classes in D are by reference. Am I right there? At least, for the following examples, there were no unnecessary temporaries:
>>
>> a = b + c; // constructor of mpz_class was called once, so temporary was assigned directly to the new reference a, without copying data.
>> a = (b+c) / (d+e); // constructor was called three times, for (b+c), for (d+e) and for the result.
>>
>> Any ideas or corrections?
>>
>> best regards
>> Matthias Walter
> 
> I don't believe that anyone started a new GMP project for D up to now.
> Don Clugston (dac at nospam.com.au) claimed to have a copy of the old code of Ben Hincle. You could try to contact him directly.
> 
> I would be very happy to see a working GMP wrapper class for D.
> 
> ~michael

OK, here's Ben Hinkle's sources. But as I said, I don't think it's much use.
BTW, that's not my real email address.
-Don.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp-d.zip
Type: application/zip
Size: 23108 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20070924/31e4e5a4/attachment.zip>


More information about the Digitalmars-d mailing list