mpz_perfect_power companion

Seth Troisi braintwo at
Tue Mar 26 20:09:43 UTC 2019

Add companion for mpz_perfect_power_p that returns the exponent and
optionally the root. Possible name mpz_rootexact. Marco suggested some
alternative functions, which could test a number and extract its nth power.
(Sept/Oct 2012).
I saw this item under "list of planned GMP improvements"
<> and it sounded like something I could

I have experience using gmp and writing C++ code but not a lot of
experience writing clean performant C code. It would be nice to confirm
that the current maintainers have time to review (and help improve) patches
that I'd be writing.

I thought a good first step would be to add support for the two related
functions (mpz_perfect_power_p, mpz_perfect_square_p) in tune/speed which I
already started on.

Let me know if this sounds reasonable,

More information about the gmp-devel mailing list