stupid long integers 1.976999999999999999e-15

[code] dim js as new JSONItem(data)
dim ticker as JSONItem = js.Value(“result”)
ticker.DecimalFormat = “#.######”
dim bid as string
dim ask as string
dim last as string

bid = ticker.value(“Bid”)
ask = ticker.value(“Ask”)
last = ticker.value(“Last”)

mainWindow.Title = “BTC-” + selectedCurrency + " Bid: " + bid + " Ask: " + ask + " Last: " + last[/code]

This is my code… taking this json

{"success":true,"message":"","result":{"Bid":0.00197001,"Ask":0.00199977,"Last":0.00195002}}

it should display the number like 0.0019700 but instead it displays some crazy long
1.969999999999999999e-14 (or something like that…) what in the heck is going on…
Anyone can help ?

[quote] bid = Format(ticker.value(“Bid”), “0.########”)
ask = Format(ticker.value(“Ask”), “0.########”)
last = Format(ticker.value(“Last”), “0.########”)[/quote]

Got it thanks!

You realize by definition any number that contains a decimal point is NOT an INTEGER

He just got confused for a moment about stored value x presentation needing formating.

The .DecimalFormat is used just when converting the JSONItem toString()

When the other side receives a number, formated as you desired, its converted back to it’s internal numeric representation (maybe truncated as you could have instructed).

Any case, any side, a pure numeric item needs formating to the presentation, or the system will use an arbitrary “best fit” format for that value. Like the String = Variant as it was made.