程序代码如下:(仅发可调用程序)
Public Function MCC4(D1 As String, D2 As String) As String ';大整数的除法
Dim ss
ss = MBJC(D1, D2)
If ss = -1 Then
MCC4 = "0" & "/" & D1
Else
If ss = 0 Then
MCC4 = 1
Else
If Len(D1) = Len(D2) Then
Do While MBJC(D1, D2) >= 0
S1 = S1 + 1
D1 = MPC(D1, D2)
Loop
If D1 = 0 Then
MCC4 = S1
Else
MCC4 = S1 & "/" & D1
End If
Else
If Len(D2) < 9 Then
MCC4 = MCC(D1, D2)
Else
Dim X, Y ';定义分段长度
X = Len(D1) \ 4: Y = Len(D2) \ 4
If Len(D1) > 4 * X Then
X = X + 1
D1 = String(4 * X - Len(D1), "0") & D1
ElseIf Len(D2) > 4 * Y Then
Y = Y + 1
D2 = String(4 * Y - Len(D2), "0") & D2
Else
D1 = String(4 * X - Len(D1), "0") & D1
D2 = String(4 * Y - Len(D2), "0") & D2
End If
X = Len(D1) \ 4: Y = Len(D2) \ 4
Dim JW, jcc, jss, jcs
Dim A() As String, B() As String
ReDim A(1 To X)
ReDim B(1 To Y)
For I = 1 To X
A(I) = Mid(D1, I * 4 - 3, 4)
Next
For J = 1 To Y
B(J) = Mid(D2, J * 4 - 3, 4)
jws = jws & A(J)
Next
If Len(qqdl(Trim(jws))) <= Len(qqdl(D2)) Then
jcc = Val(Left(qqdl(A(1) & A(2)), 2)) \ Val(Left(qqdl(B(1) & B(2)), 2))
Else
jcc = Val(Left(qqdl(A(1) & A(2)), 2 + Len(qqdl(Trim(jws))) - Len(qqdl(D2)))) \ Val(Left(qqdl(B(1) & B(2)), 2))
End If
jss = MbC(Trim(jcc), D2)
Do While MBJC(Trim(jws), Trim(jss)) = -1
jcc = jcc - 1
jss = MbC(Trim(jcc), D2)
Loop
JW = MPC(Trim(jws), Trim(jss))
z = X - Y
Dim c() As String
ReDim c(1 To z)
For s = 1 To z
If MBJC(JW & A(s + Y), D2) = -1 Then
c(s) = "0000"
Else
If Len(qqdl(JW & A(s + Y))) = Len(qqdl(D2)) Then
jwc = Val(Left(qqdl(JW & A(s + Y)), 4)) \ Val(Left(qqdl(B(1) & B(2)), 4))
Else
If Len(qqdl(JW & A(s + Y))) <= Len(qqdl(D2)) Then
jwc = Val(Left(qqdl(JW & A(s + Y)), 4)) \ Val(Left(qqdl(B(1) & B(2)), 4))
Else
jwc = Val(Left(qqdl(JW & A(s + Y)), 4 + Len(qqdl(JW & A(s + Y))) - Len(qqdl(D2)))) / Val(Left(qqdl(B(1) & B(2)), 4))
jwc = Format(Val(jwc), "0.000000")
If InStr(jwc, ".") = 0 Then
jwc = jwc
Else
jwc = Left(jwc, InStr(jwc, ".") - 1)
End If
End If
End If
c(s) = jwc
End If
jsw = MbC(Trim(c(s)), Trim(D2))
Do While MBJC(JW & A(s + Y), Trim(jsw)) = -1
c(s) = c(s) - 1
jsw = MbC(Trim(c(s)), D2)
Loop
JW = MPC(JW & A(s + Y), MbC(Val(c(s)), D2))
Do While MBJC(Trim(JW), Trim(D2)) >= 0
jwc1 = jwc1 + 1
JW = MPC(Trim(JW), Trim(D2))
Loop
c(s) = Val(c(s) + jwc1)
c(s) = Right(100000000 + Val(c(s)), 4)
jcc = jcc & c(s)
Next s
If JW = 0 Then
MCC4 = jcc
Else
MCC4 = jcc & "/" & JW
End If
For I = 1 To Len(MCC4)
If Not Mid(MCC4, I, 1) = "0" Then
Exit For
End If
Next
strTmp = Mid(MCC4, I)
If Len(strTmp) = 0 Then
MCC4 = "0"
Else
MCC4 = strTmp
End If
End If
End If
End If
End If
End Function