www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - GMP (GNU multiple precision) wrapper for D?

reply Michael Kiermaier <michael.kiermaier gmx.net> writes:
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.

Does anybody know about the status of that page?
Or is there another GMP project for D?

Thanks,

~michael
Aug 05 2007
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Michael Kiermaier" <michael.kiermaier gmx.net> wrote in message 
news:f95mcl$j7e$1 digitalmars.com...
 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.

 Does anybody know about the status of that page?
 Or is there another GMP project for D?
All of the Alioth shootout benchmarks for D use GMP, but unfortunately they point to the same (dead) site..
Aug 05 2007
prev sibling next sibling parent reply Don Clugston <dac nospam.com.au> writes:
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.
Aug 05 2007
parent reply Matthias Walter <walter mail.math.uni-magdeburg.de> writes:
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
Sep 22 2007
next sibling parent reply Michael Kiermaier <michael.kiermaier gmx.net> writes:
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 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
Sep 22 2007
parent reply Don Clugston <dac nospam.com.au> writes:
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 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.
Sep 24 2007
parent Michael Kiermaier <michael.kiermaier gmx.net> writes:
Don Clugston Wrote:

 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 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.
Seems that I was totally blind when I copy-and-pasted your email address... ~michael
Sep 24 2007
prev sibling parent Witold Baryluk <baryluk smp.if.uj.edu.pl> writes:
Dnia Sat, 22 Sep 2007 07:58:12 -0400
Matthias Walter <walter mail.math.uni-magdeburg.de> napisa=B3/a:


 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?
This can be helpful: http://smp.if.uj.edu.pl/~baryluk/d/onpd/onp/arithmetic/gmp/ --=20 Witold Baryluk, aleph0 MAIL: baryluk smp.if.uj.edu.pl JID: movax jabber.autocom.pl
Sep 23 2007
prev sibling parent reply dennis luehring <dl.soluz gmx.net> writes:
just a "hypothetical" question

should have D direkt bignum support (like for complex numbers)
or is there no benefit of having such feature in the language?

ciao dennis
Sep 23 2007
parent Matthias Walter <walter mail.math.uni-magdeburg.de> writes:
dennis luehring Wrote:

 just a "hypothetical" question
 
 should have D direkt bignum support (like for complex numbers)
 or is there no benefit of having such feature in the language?
 
 ciao dennis
AFAICS, there is no benefit - syntactically (from the users point of view), handling gmp bignums will be as easy as ints and as there are many complex algorithms, which are partially written in handcrafted assembly (in the GMP library), this won't be a good option. best regards Matthias
Sep 23 2007