JDK-8032027 : Add BigInteger square root methods
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.math
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-01-16
  • Updated: 2024-10-03
  • Resolved: 2015-12-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b97Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
Two possible square root methods are proposed:

1) Square Root

public BigInteger sqrt() {}

Returns a BigInteger whose value is (floor(sqrt(this))), where sqrt(.) denotes the mathematical square root of the mathematical value of this.

2) Square Root with Remainder

Returns an array of two BigIntegers containing (s = floor(sqrt(this))) followed by (this - s^2), where sqrt(.) denotes the mathematical square root of the mathematical value of this.

public BigInteger[] sqrtAndRemainder() {}

A third method such as "BigInteger sqrtRemainder()" is also feasible but would simply be equal to sqrtAndRemainder()[1].
Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/3a2e54394b62 User: lana Date: 2015-12-16 19:10:55 +0000
16-12-2015

URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/3a2e54394b62 User: bpb Date: 2015-12-11 01:53:14 +0000
11-12-2015

Review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-October/035597.html http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-November/036607.html http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-December/037109.html
10-12-2015

Algorithms for finding the square root with or without remainder for larger multi-precision integers are discussed in Paul Zimmermann, "Karatsuba Square Root", INRIA Research Report 3805, November 1999, http://hal.inria.fr/inria-00072854/PDF/RR-3805.pdf
18-09-2015