A perfect power, and then?
bodrato at mail.dm.unipi.it
bodrato at mail.dm.unipi.it
Wed Oct 24 07:51:03 CEST 2012
Ciao,
Il Mar, 23 Ottobre 2012 10:50 pm, Torbjorn Granlund ha scritto:
> nisse at lysator.liu.se (Niels Möller) writes:
> Torbjorn Granlund <tg at gmplib.org> writes:
> > It is tempting to let mpz_perfect_power_p
> > return p, but unfortunately it has type 'int' which might be too
> > Any suggestions for a new function interface?
> mp_bitcnt_t mpz_perfect_power_p (mpz_t x);
>
> is mostly right. If x is a perfect power, return an exponent > 1,
> otherwise zero.
>
> A disadvantage is that this is an incompatible change.
A possible backward compatible interface is: "Returns zero if op is not a
perfect power. Otherwise the exponent p is computed. The function returns
p if it fits in an int, or -1 if it doesn't". Not exciting, but it always
gives some information.
Regards,
Marco
--
http://bodrato.it/papers/
More information about the gmp-devel
mailing list