Integer square root
For example, because and .
to ensure that
Domain of computation
Although is irrational for almost all , the sequence contains only rational terms when is rational. Thus, with this method it is unnecessary to exit the field of rational numbers in order to calculate , a fact which has some theoretical advantages.
One can prove that is the largest possible number for which the stopping criterion
ensures in the algorithm above.
In implementations which use number formats that cannot represent all rational numbers exactly (for example, floating point), a stopping constant less than one should be used to protect against roundoff errors.