Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8032027

Add BigInteger square root methods

XMLWordPrintable

    • b97
    • Verified

      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].

            bpb Brian Burkhalter
            bpb Brian Burkhalter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: