mpz_pow question

Digital Parasite digital.parasite at
Tue Oct 14 19:12:31 CEST 2008

I'm new to GMP, so far my program is working great but I don't
understand why a couple of GMP mpz_pow related functions are missing.
 mpz_pow_ui and mpz_ui_pow_ui only allow you to use an unsigned long
int for the exponent.

Is there a reason GMP doesn't include mpz_pow and mpz_ui_pow so that
you can also use an mpz_t for the exponent?

If I want to do something like 2^n or 3^p right now I need to use
mpz_ui_pow_ui(rop, 2, mpz_get_ui(n)); or mpz_ui_pow_ui(rop, 3,
mpz_get_ui(p)); for it to work and then it will only accept exponents
in the unsigned long int range.

Is there another way for me to do this and I just can't see or is
mpz_pow() so long it wouldn't make any sense to use values larger than
an unsigned long int?


More information about the gmp-discuss mailing list