Not sure what is happening here… I’m on Xojo 2021 1.1 OSX Big Sur.
I have a simple JSON string thus:
when I do this:
Var jbuf As New JSONItem
the “data” values in jbuf are show as:
what am I missing here(or doing wrong)? Maybe its some Xojo oddness?..
It’s computers. Eg you cannot express 0.1 in Binary, you can only approximate it.
When showing the numbers you could use Format
Anyone know if there is a feature request to allow us to define the DecimalFormat? (and work as defined)
That’s computers binary base oddness to human eyes needing base 10 to understand a value.
More bits, more precision, more base 10 like results, less bits, more binary conversion loss.
If a computer has 32 bit to express a fractional number, let’s say 0.1, it does it as this:
That’s all sums of fractions of 1/2^x, +1, as mantissa, times 2^y as exponent
ahh I though tit was defaulting to something sensible but as Alberto points out the ‘decimal format’
is there. looks like it could be set but is now deprecated. looping through all the values and correcting them with format(string,"#.##") works
You could of course use Bob’s Decimal Plugin: Decimal Plugin