serie of sqrt
l.couraud at free.fr
Sat Mar 13 18:46:19 CET 2004
First, sorry for my bad English, I am French.
I think that it have a way in that the calculus of mpz_sqrt will can be more
good than the method used actually in gmp
In fact it is the case when the user want the square root of a series of
integer that differ by a small value
Suppose that we search a value of an integer n that verify:
a + n*h = b^2
Where a, n, h and b are all integer and h is very less than a.
I think that in this case it will be good to calculate the square root of a
Then for the next value of h, we can call a function like:
mpz_sqrt_init(rop, op, initialvalue);
Then in the example, we will call this function like this:
mpz_sqrt_init(b, a+n*h, a0);
a0 = b;
Because the entire part of the square root of a + n*h and the entire part
of the square root of a + (n + 1)*h can be equal or very near, if we inject
the initial value in the Newton algorithm we probably gain the square root
with a very small number of iteration.
In addition, may be we can use in the same idea a function like:
More information about the gmp-devel