Category talk:Wren-big: Difference between revisions
→Source code: Bug fix.
(→Source code: Added testBit method to BigInt.) |
(→Source code: Bug fix.) |
||
Line 114:
static integerLogarithm_(value, base) {
if (base <= value) {
var tmp = integerLogarithm_(value, base.square)
var p = tmp[0]
Line 344 ⟶ 343:
// Private method to multiply two lists 'x' and 'y' using the Karatsuba algorithm.
static multiplyKaratsuba_(x, y) {
var n = (x.count > y.count) ?
if (n <= 30) return multiplyLong_(x, y)
n = (n/2).
var a = x[0...n]
var b = x[n..-1]
var c = y[0...n]
var d = y[n..-1]
var ac = multiplyKaratsuba_(a, c)
var bd = multiplyKaratsuba_(b, d)
|