Decimal Plugin use and question

I hope this is the right forum, I was thinking on posting to Getting Started.

I need to do exact calculations with many values that have 5 decimals, sometimes a few with 12 decimals. The docs say to use Currency instead of Double for such calculations but Currency only handle 4 decimals.

I downloaded the Decimal Plugin from Bob Delaney from here.

After testing, I see that I can’t assign numbers with many decimals directly or from double, only from string:

Dim dTest As Decimal dTest = 3.14159265358979323846264338327950 DecSetScale(15) MsgBox dTest.Str // 3.141592653589800 Dim dblTest As Double = 3.14159265358979323846264338327950 dTest = dblTest // same as using dTest = New Decimal(dblTest) MsgBox dTest.Str // 3.141592653589800 dTest = New Decimal("3.14159265358979323846264338327950") MsgBox dTest.Str // 3.141592653589793 dTest = New Decimal(dblTest.ToText) MsgBox dTest.Str // 3.141593000000000 dTest = New Decimal(dblTest.ToText(Xojo.Core.Locale.Raw,"#.000000000000000")) MsgBox dTest.Str // 3.141592653589790 dblTest = dTest dTest = dblTest MsgBox dTest.Str // 3.141592653589800

My guess it the way this plugin interacts with Double, it converts the input to double and only “see” that many decimals.

I think Double.ToText limit the number of decimals to 6 and using format it can be up to 14.

Then I teste with more digits and same decimals. It looks like the double conversion can handle only 14 digits total.

Someone with experience with this plugin, the only way to keep all digits/decimals is using:

z = New Decimal(InputString As String)?

Note: Recently I found out that this plugin leaks memory, I will not use it a lot and the program will not run 24hrs a day.

At the bottom of Bob’s homepage there is an email address.
You can contact Bob and ask him for help.