nisse at lysator.liu.se
Wed Aug 10 12:18:53 CEST 2011
Vincent Lefevre <vincent at vinc17.net> writes:
> I've attached a small program I've written that shows how this can
> be done. It uses double-precision arithmetic, but of course, the
> same algorithm works in fixed point (so that mpz can be used). With
> the included parameters, it can compute log2(x) with x between 1 and
> 2^64 at least.
Hmm, it starts by computing a table using log1p, with the value
log_2(1+2^k) for various positive and negative integer k. Do I
understand that correctly?
Then, the method seems suitable for computing log_2 at run time, but not
so suitable in the bootstrap context where we want to tabulate certain
logarithms, without relying on other tables, (or on floating point
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel