libgmp deimos library

Andrew Hall via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 11 05:53:18 PST 2017


On Wednesday, 11 January 2017 at 12:50:15 UTC, Nordlöw wrote:
> On Wednesday, 11 January 2017 at 10:29:26 UTC, Andrew Hall 
> wrote:
>> https://github.com/andrew-m-h/libgmp
>
> Nice. I'll make use of it in my high-level wrapper at
>
> https://github.com/nordlow/phobos-next/blob/master/src/gmp.d
>
> instead of my hand-coded externs.
>
> It is currently well tested (unittests give 100 % code 
> coverage) but not completed. Majority of integer support is 
> there. Nothing else.
>
> I'll put up a DUB package soon. I guess gmp-d would be a good 
> name.
>
> It's worth mentioning that compile-and-link of gmp.d of a 
> debug-build including unittests take 0.07 seconds on my machine 
> :)

If you would like some test cases that I wrote for my mpz_t 
wrapper, you should look in 
https://github.com/andrew-m-h/libgmp/blob/master/source/deimos/gmp/operators.d and take the bottom two unittests.
The test cases are more complex than just your usual a + b:
- a verification of Fermat's Little Theorem for mersenne primes 
M(p) p < 200
- a 'rediscovery' of Lander & Parkin's counter example to Euler's 
Sum of Powers Conjecture.
  i.e. finding: 27^5 + 84^5 + 110^5 + 133^5 = 144^5

They should be trivially translateable to your interface, and 
test out your library for speed ;)

I was planning on extending this wrapper but since you have one, 
you may as well have the test cases.


More information about the Digitalmars-d mailing list