BiggerNumberMBS class

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

BiggerNumberMBS class

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

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

Dim DaysPerYear As New BiggerNumberMBS(365.25)

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

// 9.460.730.472.580.800 matches number from Wikipedia


Dim AgeOfUniversum As New BiggerNumberMBS(13810000000)

Dim MaxDistance As BiggerNumberMBS = LightYear * AgeOfUniversum

MsgBox MaxDistance.GetStringValue(10, False, 100, 3, True)+" meter maximum"

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.

This class has no sub classes.

Blog Entries

Xojo Developer Magazine

Videos

Release notes


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


BevelButton   -   BigNumberConversionMBS


💬 Ask a question or report a problem