RFR of 8032027: Add BigInteger square root methods
brian.burkhalter at oracle.com
Fri Oct 2 20:41:41 UTC 2015
Please review at your convenience.
Summary: Add sqrt() and sqrtAndRemainder() methods. The square root calculated is the integer square root ’s’ such that for a given integer ’n’ the value of ’s’ is the largest integer such that s*s <= n. In other words it is the floor of the mathematical square root of the value ’n' taken as a mathematical real number.
The method of calculation is Newton iteration starting from a value larger than the square root which ensures that the convergence is monotonically decreasing to the result. An effort is made to make the implementation efficient in particular with respect to the amount of memory used. Any suggestions as to the improvement of the approach concerning memory use or any other aspect of the algorithm would be appreciated, as would be suggestions regarding the test.
More information about the core-libs-dev