donJ
2017-04-26 20:06:24 UTC
Hi,
What I would like to do is save the value of a double to a text file and
be able to retrieve it, but Str(d) seems to truncate the value to 7
digits. Format does the same, it just adds zeros.
I tried this code in a push button:
Dim d1, d2 as double
Dim s as string
d1 = 12345.12345
s = Str(d1)
d1 = val(s)
msgbox s //==> shows 12345.12 truncated to seven digits
//==> same result with the decimal in any position
d2 = 12345.12345
if d1 = d2 then
msgbox "yes"
else
msgbox "no" //==> they are not the same
end if
A double should have a precision of far more than seven digits, (I think
it's about 15).
What's the best way to save this value in a text file?
Thanks in advance,
Don
_______________________________________________
Xojo forum:
https://forum.xojo.com/
What I would like to do is save the value of a double to a text file and
be able to retrieve it, but Str(d) seems to truncate the value to 7
digits. Format does the same, it just adds zeros.
I tried this code in a push button:
Dim d1, d2 as double
Dim s as string
d1 = 12345.12345
s = Str(d1)
d1 = val(s)
msgbox s //==> shows 12345.12 truncated to seven digits
//==> same result with the decimal in any position
d2 = 12345.12345
if d1 = d2 then
msgbox "yes"
else
msgbox "no" //==> they are not the same
end if
A double should have a precision of far more than seven digits, (I think
it's about 15).
What's the best way to save this value in a text file?
Thanks in advance,
Don
_______________________________________________
Xojo forum:
https://forum.xojo.com/