Forum Discussion
RokuKC
7 years agoRoku Employee
"Komag" wrote:
Try this:
? 1.1* 9
console prints 9.9
But try this:
? str(1.1 * 9)
console prints 9.900001
A couple of options:
x=1.1 * 9
' 1) use Fix to try to force 1 digit of precision. may or may not work?
? Str(Fix(x * 10)/10)
' 2) use printf-style conversion
? x.ToStr("%3.1f")
' Note that Str prefixes a blank on non-negative numbers, the above ToStr does not.
' if you want that, use x.ToStr("% 3.1f")