Decimal places in Double

is it possible to limit Double values to 2 decimal places, or choose the precision in some way?

This happens:

Dim Value As Double = 3.14 'initialize with the value - this could be from a DB record for example me.Text = Value.ToText ' shows like this 3.140000

I know I can use Currency but for an object property like Pi for example, Currency seems like the ‘wrong’ type to use to describe that attribute.

you may need to use str() and provide a format specification in order to get two digits after the decimal separator.

as to “choose the precision”… to a point… as the more digits to the right of the decimal point, the less accurate it is.
This (as has been discussed before)… it not the fault of Xojo, but of the IEEE definition of a “Double”

If you want to stick with Text, see (the example on that page is a bit broken)

Dim Value As Double = 3.14 Me.Text = Value.ToText(Xojo.Core.Locale.Current, "#.00")

@Dave S - I was reading about that too, I was just a little surprised that I couldn’t find anything in the docs that dealt with numeric precision.

@JulianS - thanks! that will be what I need.

Rob, this might be what you are looking for:

I wish it was an official Xojo data type.