Private Sub Command1_Click()
Dim j1&, j2&, e&, d&, e1&
'开始计算乘法
t2 = Timer
' 按列法计算C=A*B
m = Trim(Text1): n = Trim(Text2)
x = Len(m): y = Len(n)
Dim a(), b()
ReDim a(1 To x): ReDim b(1 To y)
For i1 = 1 To x
a(i1) = Mid(m, i1, 1)
Next
For i2 = 1 To y
b(i2) = Mid(n, i2, 1)
Next
Private Sub Command1_Click()
Dim j1&, j2&, e&, d&, e1&
'开始计算乘法
t2 = Timer
' 按列法计算C=A*B
m = Trim(Text1): n = Trim(Text2)
X = Len(m) \ 4: Y = Len(n) \ 4
m = String(4 * X + 4 - Len(m), "0") & m
n = String(4 * Y + 4 - Len(n), "0") & n
X = X + 1: Y = Y + 1
Dim a(), b()
ReDim a(1 To X): ReDim b(1 To Y)
For i1 = 1 To X
a(i1) = Mid(m, i1 * 4 - 3, 4)
Next
For i2 = 1 To Y
b(i2) = Mid(n, i2 * 4 - 3, 4)
Next
ma = X: mb = Y
MC = ma + mb
ReDim c(MC)
e1 = 0
j1 = ma: j2 = ma
For i = MC To 2 Step -1
If i <= ma Then j2 = i - 1
e = e1: e1 = 0
For j = j1 To j2
e = e + a(j) * b(i - j)
If e > 2040000000 Then '减少进位次数
e = e - 2040000000
e1 = e1 + 204000
End If
Next j
If j1 > 1 Then j1 = j1 - 1
'
base = 10000
d = e \ base
c(i) = e - d * base
If Len(c(i)) < 4 Then
c(i) = String(4 - Len(c(i)), "0") & c(i)
Else
c(i) = c(i)
End If
jc = c(i) & jc
e1 = e1 + d