Author:水如烟
用户使用的大数运算类
这里只是简单提供。可以考虑让它自动分拆多线程。
BigInt.vb
<Serializable()> _
Public Class BigInt
Private gMath As New MathsUnit
Public Property StringValue() As StringValue
Get
'转换为原存储方式
Return gMath.StringValue.CopyTo(gMath.OrignalAddressInfo.UnitNum)
End Get
Set(ByVal value As StringValue)
gMath.StringValue = value
End Set
End Property
Public Function Clone() As BigInt
Return CommonFunction.Clone(Of BigInt)(Me)
End Function
Public Sub CopyFrom(ByVal bInt As BigInt)
gMath.CopyFrom(bInt.gMath)
End Sub
Public Sub Add(ByVal bInt As BigInt)
gMath.Add(bInt.gMath)
End Sub
Public Shared Operator +(ByVal a As BigInt, ByVal b As BigInt) As BigInt
Dim c As BigInt = a.Clone
c.Add(b)
Return c
End Operator
Public Sub Multy(ByVal bInt As BigInt)
gMath.Multy(bInt.gMath)
End Sub
Public Shared Operator *(ByVal a As BigInt, ByVal b As BigInt) As BigInt
Dim c As BigInt = a.Clone
c.Multy(b)
Return c
End Operator
End Class
代码下载:代码