Retrieve the logarithm of number in a specified base ?

Evadream evadream.mlist at
Sun Dec 5 15:17:24 CET 2004

Mmmm maybe i could just use mpz_root(i,i,B) :D
Any comments or suggestions ?

Thanx !

Evadream wrote:

> Hello everybody,
> I'm discovering this fantastic library, and begin to play with it.
> Here is my problem, maybe there is a better way to do it, so please tell
> me if you know it :)
> I've got one mpz_t (an integer, for exemple i ), and i would like to find
> a to have :
> B^a < i < B^(a+1).
> My (bad ?) idea is to compute the log of i in the base B (ln(i)/ln(B)) and
> to take the integer part, but i don't see any function to deal with log in
> a specified base (only natural log, log2 and log10 using mpfr).
> Maybe you can help me ?
> Thanx !

More information about the gmp-discuss mailing list