To illustrate this with a short example analogous to your use case. Suppose I have an integer(!) variable representing centimeters, but later want to present the result in meters. With integers, there are no practical precision issues -- they can be represented just fine in binary (except for really huge ones exceeding the number of available bits). Now, however, if I do a simple mathematical conversion to meters as one would do on paper, i.e., m=cm/100, I'll end up with a floating point result on the computer, i.e., representational issues, loss of precision due to the finite number of available bits. The strategy then is to never leave the realm of precise integers, but simply do a suitable string conversion on the precise integer result to display it as meters:
<values>
/ cm = 0
/ m = ""
</values>
<expressions>
/ cminm = {
if(length(values.cm)==1)values.m=concat("0.0", values.cm);
if(length(values.cm)==2)values.m=concat("0.", values.cm);
if(length(values.cm)>2)values.m=concat(
concat(substring(values.cm,0,length(values.cm)-2),"."),
substring(values.cm, length(values.cm)-2, length(values.cm)-1))
}
/ cminm2 = (values.cm/100)
</expressions>
<trial mytrial>
/ ontrialbegin = [values.cm=round(rand(0,99999))]
/ ontrialbegin = [expressions.cminm]
/ stimulusframes = [1=mytext]
/ validresponse = (" ")
/ branch = [trial.mytrial]
</trial>
<text mytext>
/ items = ("cm: <%values.cm%> | m(string): <%values.m%> | m(math): <%expressions.cminm2%>")
</text>
<block myblock>
/ trials = [1=mytrial]
</block>
Regards,
~Dave