How to implement logarithm with GMP

Marc Glisse marc.glisse at inria.fr
Tue May 14 11:09:07 CEST 2013


On Mon, 13 May 2013, Shouwei Li wrote:

> Hi there,
>
> I am using GMP to implement the "Agrawal Kayal and Saxena algorithm" which
> is a deterministic algorithm for primality, but the GMP library does not
> support logarithm operation.
>
> I want to know is there any other method that I could implement a private
> version of log function.
>
> Thank you very much!

Depending on what your exact need is, either the logarithm is the position 
of the highest 1 in the number (see mpz_sizeinbase), or you want mpfr.

-- 
Marc Glisse


More information about the gmp-discuss mailing list