高精度整数除法
Private Sub Command1_Click() Devide 123456789, 987654321, 2000 End Sub Sub Devide(ByVal X As Long, ByVal Y As Long, Optional ByVal Numdigitsafterdecimal As Integer = 100, Optional ByRef result As String) ‘x/y取小数点后Numdigitsafterdecimal 位(默认100) Dim a() As String, temp As Double, temp2 As Long, i As Integer ReDim a(Numdigitsafterdecimal) a(0) = X & “÷” & Y & “=” & Int(X / Y) & “.” temp = X - (X Y) * Y For i = 1 To Numdigitsafterdecimal temp = temp * 10 temp2 = Int(temp / Y) a(i) = Right(temp2, 1) temp = temp - Int(temp / Y) * Y Next result = Join(a, “”) Debug.Print result End Sub ...