Re: A perfect power, and then?

2012-10-26 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: Sounds right. Such convolution type sum-of-products might want a separate function, returning 3 limbs. But I'm not talking about a convolution, but about the complete powering. If x is a candidate nth root, and x^n is of size s bits, I

Re: A perfect power, and then?

2012-10-26 Thread Niels Möller
Torbjorn Granlund t...@gmplib.org writes: I would like to avoid fp hardware in the portable parts of GMP. I guess this means: Avoid using functions from libm, and avoid using floating point in critical loops. Right? There's a (non-critical) floating point operation in mpn_perfect_power_p

Re: A perfect power, and then?

2012-10-26 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: I guess this means: Avoid using functions from libm, and avoid using floating point in critical loops. Right? There's a (non-critical) floating point operation in mpn_perfect_power_p involving some logarithm table. Right. I would actually

Re: A perfect power, and then?

2012-10-26 Thread Niels Möller
Torbjorn Granlund t...@gmplib.org writes: I just got a crazy idea. Compute the logarithm of the number (to a few bits of precision, perhaps using table lookup). Multiply this logarithm by k. Exponentiate using the logbase (again using a small table). Conservatively compare to number being

Re: A perfect power, and then?

2012-10-26 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: Ah, and if we're brain storming, yet another variant would be to compute an extra limb (or maybe only half a limb) of precision when we compute the 2-adic k'th root. If the extra limb is non-zero, then the input can't be a k'th power. That's