public BigInt sqrt() { if (less(this, ZERO)) { throw new ArgumentException("BigNumber must be >=0"); } int pos = (number.Length + 1) / 2; BigInt cur = new BigInt(pos, false); pos--; while (pos >= 0) { int l = 0, r = BASE; int curDigit = 0; while (l <= r) // подбираем текущую цифру { int m = (l + r) >> 1; cur.number[pos] = m; if (BigInt.lessEqualAbs(BigInt.multiply(cur, cur), this)) { curDigit = m; l = m + 1; } else { r = m - 1; } } cur.number[pos] = curDigit; pos--; } Array.Copy(cur.number, 0, this.number, 0, cur.number.Length); return(this); }