Platforms to show: All Mac Windows Linux Cross-Platform

BigNumberMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Math MBS DataTypes Plugin 16.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Function: The class for a big number.
Example:
// speed of light in m/s
Dim SpeedOfLight As New BigNumberMBS("299792458")

// seconds per day
Dim SecondsPerDay As New BigNumberMBS(24 * 3600)

Dim DaysPerYear As New BigNumberMBS(365.25)

Dim LightYear As BigNumberMBS = SpeedOfLight * DaysPerYear * SecondsPerDay
MsgBox LightYear.StringValue+" meter per light year"

// 9.460.730.472.580.800 matches number from Wikipedia


Dim AgeOfUniversum As New BigNumberMBS(13810000000)

Dim MaxDistance As BigNumberMBS = LightYear * AgeOfUniversum

MsgBox MaxDistance.GetStringValue(10, False, 100, 3, True)+" meter maximum"
Notes:
This is floating point number with 320 bits in BigNumber and 2560 bits in BiggerNumber class.
Precision is about 77 digits dot for the smaller one and 617 for the bigger one.
So use first for speed and second for precision.

So if you want to store currency or other values where rounding should not happen, better store values multiplied, e.g. in cents.

Compared to normal double values, you have 5 times the bits.
And we check for math errors and raise exceptions if something goes wrong.

See LargeNumberMBS for a 4128 bit integer number, about 1200 digits in length.

Feedback, Comments & Corrections

  • 15 properties
  • 51 methods
  • 55 shared methods
    • shared method Abs(value as BigNumberMBS) as BigNumberMBS
    • shared method ACos(value as BigNumberMBS) as BigNumberMBS
    • shared method ACosh(value as BigNumberMBS) as BigNumberMBS
    • shared method ACot(value as BigNumberMBS) as BigNumberMBS
    • shared method ACoth(value as BigNumberMBS) as BigNumberMBS
    • shared method ASin(value as BigNumberMBS) as BigNumberMBS
    • shared method ASinh(value as BigNumberMBS) as BigNumberMBS
    • shared method ATan(value as BigNumberMBS) as BigNumberMBS
    • shared method ATanh(value as BigNumberMBS) as BigNumberMBS
    • shared method Cos(value as BigNumberMBS) as BigNumberMBS
    • shared method Cosh(value as BigNumberMBS) as BigNumberMBS
    • shared method Cot(value as BigNumberMBS) as BigNumberMBS
    • shared method Coth(value as BigNumberMBS) as BigNumberMBS
    • shared method DegToDeg(d as BigNumberMBS, m as BigNumberMBS, s as BigNumberMBS) as BigNumberMBS
    • shared method DegToGrad(d as BigNumberMBS, m as BigNumberMBS, s as BigNumberMBS) as BigNumberMBS
    • shared method DegToGrad(value as BigNumberMBS) as BigNumberMBS
    • shared method DegToRad(d as BigNumberMBS, m as BigNumberMBS, s as BigNumberMBS) as BigNumberMBS
    • shared method DegToRad(value as BigNumberMBS) as BigNumberMBS
    • shared method E as BigNumberMBS
    • shared method Exp(value as BigNumberMBS) as BigNumberMBS
    • shared method GradToDeg(value as BigNumberMBS) as BigNumberMBS
    • shared method GradToRad(value as BigNumberMBS) as BigNumberMBS
    • shared method HalfPi as BigNumberMBS
    • shared method LibTypeStr as String
    • shared method Ln(value as BigNumberMBS) as BigNumberMBS
    • shared method Ln10 as BigNumberMBS
    • shared method Ln2 as BigNumberMBS
    • shared method Log(value as BigNumberMBS, base as BigNumberMBS) as BigNumberMBS
    • shared method Max as BigNumberMBS
    • shared method Min as BigNumberMBS
    • shared method Nan as BigNumberMBS
    • shared method NumberWithCurrency(value as Currency) as BigNumberMBS
    • shared method NumberWithDouble(value as Double) as BigNumberMBS
    • shared method NumberWithInt32(value as Int32) as BigNumberMBS
    • shared method NumberWithInt64(value as Int64) as BigNumberMBS
    • shared method NumberWithInteger(value as Integer) as BigNumberMBS
    • shared method NumberWithSingle(value as single) as BigNumberMBS
    • shared method NumberWithString(value as String) as BigNumberMBS
    • shared method NumberWithUInt32(value as UInt32) as BigNumberMBS
    • shared method NumberWithUInt64(value as UInt64) as BigNumberMBS
    • shared method NumberWithUInteger(value as UInteger) as BigNumberMBS
    • shared method NumberWithVariant(value as Variant) as BigNumberMBS
    • shared method One as BigNumberMBS
    • shared method Pi as BigNumberMBS
    • shared method RadToDeg(value as BigNumberMBS) as BigNumberMBS
    • shared method RadToGrad(value as BigNumberMBS) as BigNumberMBS
    • shared method Rand as BigNumberMBS
    • shared method Root(value as BigNumberMBS, index as BigNumberMBS) as BigNumberMBS
    • shared method Sgn(value as BigNumberMBS) as BigNumberMBS
    • shared method Sin(value as BigNumberMBS) as BigNumberMBS
    • shared method Sinh(value as BigNumberMBS) as BigNumberMBS
    • shared method Tan(value as BigNumberMBS) as BigNumberMBS
    • shared method Tanh(value as BigNumberMBS) as BigNumberMBS
    • shared method TwoPi as BigNumberMBS
    • shared method Zero as BigNumberMBS

This class has no sub classes.

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Videos


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


BigNumberErrorExceptionMBS   -   BlockMBS

The biggest plugin in space...




Links
MBS Xojo Chart Plugins

Start Chat