Platforms to show: All Mac Windows Linux Cross-Platform

Back to LargeNumberMBS class.

Next items

LargeNumberMBS.Add(other as LargeNumberMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds other number.

See also:

LargeNumberMBS.Add(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds other number and returns result.

See also:

LargeNumberMBS.AddMod(v as LargeNumberMBS, Modulo as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Addition with modulo.
Example
Dim v As New LargeNumberMBS(100)
Dim o As New LargeNumberMBS(200)
Dim n As New LargeNumberMBS(&hFF)

Dim r As LargeNumberMBS = v.AddMod(o, n)

MsgBox r.StringValue // shows 45 = (100+200) mod 255

LargeNumberMBS.CheckBit(bit as integer) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Checks whether a bit is set.

Returns true if bit is set.

LargeNumberMBS.Clone as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a copy of the number.

LargeNumberMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new instance with value zero.
Example
Dim l1 As New LargeNumberMBS
MsgBox l1.StringValue

See also:

LargeNumberMBS.Constructor(other as LargeNumberMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a copy of the number.
Example
Dim l1 As New LargeNumberMBS(123456789)
Dim l2 As New LargeNumberMBS(l1)

MsgBox l2.StringValue

See also:

LargeNumberMBS.Constructor(value as Int32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new instance with an 32-bit integer.

See also:

LargeNumberMBS.Constructor(value as Int64)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new instance with an 64-bit integer.

See also:

LargeNumberMBS.Constructor(value as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new number based on a string.

Raises OutOfBoundsExceptionMBS if your string is too long.

See also:

LargeNumberMBS.Constructor(value as UInt32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new instance with an unsigned 32-bit integer.

See also:

LargeNumberMBS.Constructor(value as UInt64)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new instance with an unsigned 64-bit integer.

See also:

LargeNumberMBS.Decrement(value as UInt32 = 1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Decrement number with an integer.
Example
Dim o As New LargeNumberMBS(5)
MsgBox o.StringValue
o.Increment
MsgBox o.StringValue
o.Decrement
MsgBox o.StringValue

This is faster than building a new LargeNumberMBS, just to subtract some small number.

LargeNumberMBS.Divide(other as LargeNumberMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Divides value with by value.

See also:

LargeNumberMBS.Divide(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Divides value with by value.

See also:

LargeNumberMBS.Divide(value as UInt32) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Divide by given integer and return result.
Example
Dim o As New LargeNumberMBS(63)
Dim r1 As LargeNumberMBS = o.Divide(8)
Dim r2 As UInt32 = o.Modulo(8)

MsgBox r1.StringValue+" "+str(r2) // shows 7 and 7

For small numbers this is more efficient than creating new LargeNumberMBS to store value.

See also:

LargeNumberMBS.DivMod(other as LargeNumberMBS, byref DivResult as LargeNumberMBS, byref ModResult as LargeNumberMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Performs divide and modulo together.
Example
Dim d As New LargeNumberMBS(100)
Dim n As New LargeNumberMBS(13)

Dim x As LargeNumberMBS
Dim y As LargeNumberMBS

d.DivMod n, x, y

MsgBox d.StringValue + " = " + x.StringValue + " * " + n.StringValue + " + " + y.StringValue

Puts result into both byref parameters.

LargeNumberMBS.Equals(other as LargeNumberMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compares if two numbers are equal.

Returns true if equal.

LargeNumberMBS.ExpMod(e as LargeNumberMBS, Modulo as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Calculates an exponent.
Example
Dim o As New LargeNumberMBS(2)
Dim e As New LargeNumberMBS(11)
Dim m As New LargeNumberMBS(255)
Dim r As LargeNumberMBS = o.ExpMod(e,m)

MsgBox r.StringValue // shows 8 = 2^11 mod 255

Returns x^e mod n where x is the current number, e a parameter and n the modulo parameter.

LargeNumberMBS.FindGCD(v as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Finds greatest common divisor for two positive numbers.

Some examples using this method:

LargeNumberMBS.GetStringValue(Base as Integer = 10, ThousandsDelimiter as String = "") as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 24.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries number with a given base and delimiter.
Example
Dim l As New LargeNumberMBS(1234567890)

Dim s0 As String = l.StringValue
Dim s1 As String = l.GetStringValue
// 1234567890
Dim s2 As String = l.GetStringValue(10, ",")
// 1,234,567,890
Dim s4 As String = l.GetStringValue(8, "")
// 499602d2
Dim s3 As String = l.GetStringValue(16, "")
// 11145401322

Break // check in debugger

With all default parameter, this is same as StringValue property.

LargeNumberMBS.Increment(value as UInt32 = 1)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Increment number with an integer.
Example
Dim o As New LargeNumberMBS(5)
MsgBox o.StringValue
o.Increment
MsgBox o.StringValue
o.Decrement
MsgBox o.StringValue

This is faster than building a new LargeNumberMBS, just to add some small number.

LargeNumberMBS.IsPrime(iter as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Checks if number is a prime number.
Example
Dim lines() As String

For i As Integer = 61 To 69 Step 2
Dim a As New LargeNumberMBS(i)
lines.Append a.StringValue+": "+Str(a.IsPrime(5))
Next

MsgBox Join(lines, EndOfLine)

Returns 1 if prime and 0 if not.
Returns -1 in case of error.

Iter is the factor between 1 and 680 about how deep to iterate. The bigger the this factor, the more exact the check is.

Miller-Rabin Algorithm (ret=1 .. n is composit)

LargeNumberMBS.LeftShift(bits as integer) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Shifts value to left by given number of bits.

Bits must be <= 32.

LargeNumberMBS.ModInverse(Modulo as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This function calculates modular multiplicative inverse of an given integer a modulo m.
Example
Dim l As New LargeNumberMBS(3)
Dim n As New LargeNumberMBS(26)

Dim r As LargeNumberMBS = l.ModInverse(n)

MsgBox r.StringValue

LargeNumberMBS.Modulo(other as LargeNumberMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Modulo value.

Divides value and returns the rest.

See also:

Some examples using this method:

LargeNumberMBS.Modulo(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Modulo value.

Divides value and returns the rest.

See also:

LargeNumberMBS.Modulo(value as UInt32) as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Divide by given integer and return remainder.
Example
Dim o As New LargeNumberMBS(63)
Dim r1 As LargeNumberMBS = o.Divide(8)
Dim r2 As UInt32 = o.Modulo(8)

MsgBox r1.StringValue+" "+str(r2) // shows 7 and 7

For small numbers this is more efficient than creating new LargeNumberMBS to store value.

See also:

LargeNumberMBS.MulMod(v as LargeNumberMBS, Modulo as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Multiply with modulo.
Example
Dim o As New LargeNumberMBS(50)
Dim f As New LargeNumberMBS(80)
Dim m As New LargeNumberMBS(255)
Dim r As LargeNumberMBS = o.MulMod(f, m)

MsgBox r.StringValue // shows 175 = (50 * 80) mod 255

LargeNumberMBS.Multiply(other as LargeNumberMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Multiplies value with other value.

See also:

LargeNumberMBS.Multiply(value as UInt32) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Multiply by given integer and return result.
Example
Dim o As New LargeNumberMBS(5)
Dim r As LargeNumberMBS = o.Multiply(8)

MsgBox r.StringValue // shows 40

For small numbers this is more efficient than creating new LargeNumberMBS to store value.

See also:

LargeNumberMBS.Negate as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Negates the value.

Returns new value with different sign.

LargeNumberMBS.Operator_Add(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds other number and returns result.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(20)
Dim o As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(10)

Dim r As LargeNumberMBS = l+o
Dim s As LargeNumberMBS = o+l

MsgBox r.StringValue+" "+s.StringValue

LargeNumberMBS.Operator_AddRight(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds other number and returns result.

LargeNumberMBS.Operator_And(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Performs bitwise AND operator on the values.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(16+4)
Dim o As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(4+2)

Dim ra As LargeNumberMBS = l And o
Dim ro As LargeNumberMBS = l Or o

MsgBox ra.StringValue +" "+ro.StringValue

Returns new value.

LargeNumberMBS.Operator_Compare(other as LargeNumberMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compares two values.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(20)
Dim o As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(10)

If l > o Then
MsgBox "l is bigger"
Else
MsgBox "o is bigger"
end if

Returns -1, 1 or 0.

LargeNumberMBS.Operator_Convert as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Converts the number to string.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(23)
MsgBox l

See also:

LargeNumberMBS.Operator_Convert(value as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Converts string to large number.
Example
Dim l As LargeNumberMBS = "123"
MsgBox l

See also:

LargeNumberMBS.Operator_Divide(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Divides value by other value.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(21)
Dim o As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(3)
Dim r As LargeNumberMBS = l / o

MsgBox r.stringValue

LargeNumberMBS.Operator_DivideRight(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Divides value by other value.
Example
Dim o As New LargeNumberMBS(5)

// "10" is auto converted to LargeNumberMBS and Operator_DivideRight is called
Dim r As LargeNumberMBS = "10" / o

MsgBox r.StringValue

LargeNumberMBS.Operator_Modulo(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Modulo value.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(23)
Dim o As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(3)
Dim r As LargeNumberMBS = l Mod o

MsgBox r.stringValue

Divides value and returns the rest.

LargeNumberMBS.Operator_ModuloRight(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Modulo value.

Divides value and returns the rest.

LargeNumberMBS.Operator_Multiply(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Multiplies value with other value.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(4)
Dim o As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(5)
Dim r As LargeNumberMBS = o*l

MsgBox r.stringValue

LargeNumberMBS.Operator_MultiplyRight(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Multiplies value with other value.
Example
Dim o As New LargeNumberMBS(5)

// "10" is auto converted to LargeNumberMBS and Operator_MultiplyRight is called
Dim r As LargeNumberMBS = "10" * o

MsgBox r.StringValue

LargeNumberMBS.Operator_Negate as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Negates the value.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(20)
Dim r As LargeNumberMBS = -l

MsgBox r.StringValue

LargeNumberMBS.Operator_Or(other as LargeNumberMBS) as LargeNumberMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Math MBS DataTypes Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Performs bitwise OR operator on the values.
Example
Dim l As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(16+4)
Dim o As LargeNumberMBS = LargeNumberMBS.NumberWithInteger(4+2)

Dim ra As LargeNumberMBS = l And o
Dim ro As LargeNumberMBS = l Or o

MsgBox ra.StringValue +" "+ro.StringValue

Returns new value.

Next items

The items on this page are in the following plugins: MBS DataTypes Plugin.


The biggest plugin in space...