Retrieving more Digits after comma

Hi All,
although I define the Field input to store the division result with an 8 digit format.
144 / 17
// ##,###.00000000
my division operation seems to only return 6 digits after coma.
8.470588
//-----------
Var nombre As Double = input1.Value.ToInteger
Var quotien As Double = input2.Value.ToInteger
Var x As Double
x = nombre /quotien
ResuDIV.Value = x.ToString
//------------

Is there a way/Format that cab retreive more digits ?
such as :
8,470588235

Thanks for the tips

``````ResuDIV.Value = x.ToString("0.################################################")
``````

Note that precision is limited, so not accurate after a specific decimal depth.

the “0” says use a numeric value, if none available set to 0.
the “#” means show a value if there is one otherwise show none.

mmm…so Xojo offers no choice to get a larger decimal depth, at all ?

Xojo? It’s your computer that can’t give better precision. You should look up double precision here:

There was a plugin for that, but I forgot the names.

BigNumber ?

Ok it’s the decimal plugin, here is another one…
http://delaneyrm.com/fpPlugin.html

Thanks guys, I will try to install this plugin…

@DerkJ one calculator on my Os returns : 144:17 = 8,47058823529411764706

google says 144 / 17 = 8.47058823529 thats as much as you can squees out of it.

Most calculators show you the “safe” length.

As for this plugin @AlbertoD is sharing
The note mentions : “…fp Plugin is compiled for Mac OS X, Windows, and Linux.”

Question :
Do I have to understand that I will always get the exact same precision for a division on all 3 OS :
…8,470588235294

or as @DerkJ seems to point out… only the 6 first decimal will be safe on all of these OSes ?

I’m not sure about the actual length if decimals that will be precise as it depends on the length of the left part i guess. Maybe @Christian_Schmitz or @Tim_Hare know the correct answers for this?

1 Like

delaneyrm
That’s him !

Double has max 15 digits precision.
Does not matter where the decimal dot is.

Check our BigNumberMBS and LargeNumberMBS classes in our plugin for large float/integer values.

1 Like

Hi Alberto, I 'm trying to figure out how to make use of this plugin in my script (so as to see it in action) I’ve never config plugin use in Xojo - only made a copy of fpPlugin.zip in the plugin folder…

• Would you know how to set it up in an Action button for my division ?
Thanks

I only have experience with Decimal Plugin.
Steps:

• unzip DecimalPlugin.zip
• copy ‘Decimal Plugin.xojo_plugin’ to Xojo’s Plugin folder
• restart Xojo

put this code in Action event:

``````var nombre as decimal = 144
var quotien as decimal = 17
var x as Decimal
DecSetPrecision(32)
DecSetScale(25)
x = nombre / quotien
ResuDIV.Value = str(x)
``````

str(x) will be 8.4705882352941176470588235 because we set the scale to 25, if you set it to 20 you will get the same result as your OS calculator.

1 Like

yes. fpplugin has been completely rewritten to calculate the same manner on all platforms.

1 Like

Thanks Guys

Great… now this one (or all plugin?) does not mention the IOS plateform.

• Is it possible that this very plugin is not built to operate on IOs Mobile device ?
• How about Web App ?

Thanks a lot for all these details…
oh, it needs to be unziped too