« FileMaker DevCon 2017… | Home | Xojo Meeting in Madri… »

Big numbers for Xojo

The last weeks, I saw a need for a floating point class with more than 64-bit precision.
The main problem with double variables is the lack of precision with 15 or more digits.

With 16.5 plugin we introduce a new class called BigNumberMBS. This class uses 320 bits and can easily represent 100 digits long values. You can use it easily for doing floating point math with more precision. Or if you need a 128 or 256 bit integer, this one will also fit. Just use this class without fractions. You can even wrap it and make a replacement for currency by multiplying all values by 10000 internally.

For all math operations, we may raise an exception in case of an error. The BigNumberErrorExceptionMBS class tells you about overflows, division by zero or other mistakes.

The class features operator overloading, so you can simply add values with + or assign one to another. In general values are read only, except for a few methods or properties which do not return a new object.

We have accessors for string, int64, currency and double values, so you can easily query those values. Via string you can of course pass much bigger values compared to double or int64.

Due to a few bugs with Xojo's overload handling, we may not offer Operator_Convert beside strings. It would be nice to directly assign double or integer values or to use them for plus or multiplication. Maybe future Xojo versions fix it and we can add those without causing ambiguous compiler errors.

Will be available next week with new prerelease. If you like to test now, send me an email.

PS: You can try with 16.5pr9 plugins and newer.
02 12 16 - 12:09
No comments

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.